diff --git a/operation.go b/operation.go index 6977ea923..59758384a 100644 --- a/operation.go +++ b/operation.go @@ -306,6 +306,8 @@ func (operation *Operation) ParseAcceptComment(commentLine string) error { operation.Consumes = append(operation.Consumes, "application/vnd.api+json") case "json-stream", "application/x-json-stream": operation.Consumes = append(operation.Consumes, "application/x-json-stream") + case "octet-stream", "application/octet-stream": + operation.Consumes = append(operation.Consumes, "application/octet-stream") default: return fmt.Errorf("%v accept type can't accepted", a) } @@ -334,6 +336,8 @@ func (operation *Operation) ParseProduceComment(commentLine string) error { operation.Produces = append(operation.Produces, "application/vnd.api+json") case "json-stream", "application/x-json-stream": operation.Produces = append(operation.Produces, "application/x-json-stream") + case "octet-stream", "application/octet-stream": + operation.Produces = append(operation.Produces, "application/octet-stream") default: return fmt.Errorf("%v produce type can't accepted", a) } diff --git a/operation_test.go b/operation_test.go index 3d4268e30..5353c046f 100644 --- a/operation_test.go +++ b/operation_test.go @@ -42,10 +42,11 @@ func TestParseAcceptComment(t *testing.T) { "multipart/form-data", "application/x-www-form-urlencoded", "application/vnd.api+json", - "application/x-json-stream" + "application/x-json-stream", + "application/octet-stream" ] }` - comment := `/@Accept json,xml,plain,html,mpfd,x-www-form-urlencoded,json-api,json-stream` + comment := `/@Accept json,xml,plain,html,mpfd,x-www-form-urlencoded,json-api,json-stream,octet-stream` operation := NewOperation() err := operation.ParseComment(comment) assert.NoError(t, err) @@ -71,10 +72,11 @@ func TestParseProduceComment(t *testing.T) { "multipart/form-data", "application/x-www-form-urlencoded", "application/vnd.api+json", - "application/x-json-stream" + "application/x-json-stream", + "application/octet-stream" ] }` - comment := `/@Produce json,xml,plain,html,mpfd,x-www-form-urlencoded,json-api,json-stream` + comment := `/@Produce json,xml,plain,html,mpfd,x-www-form-urlencoded,json-api,json-stream,octet-stream` operation := new(Operation) operation.ParseComment(comment) b, _ := json.MarshalIndent(operation, "", " ")