File tree Expand file tree Collapse file tree 5 files changed +9
-15
lines changed
Expand file tree Collapse file tree 5 files changed +9
-15
lines changed Original file line number Diff line number Diff line change 140140 "code" : " response.content-type.incompatible" ,
141141 "message" : " Response Content-Type header is incompatible with the mime-types the spec defines to produce" ,
142142 "mockDetails" : {
143- "interactionDescription" : " should error on unknown response content type" ,
143+ "interactionDescription" : " should error on unknown response content type, per status code " ,
144144 "interactionState" : " [none]" ,
145145 "location" : " [root].interactions[6].response.headers.Content-Type" ,
146146 "value" : " text/html"
Original file line number Diff line number Diff line change @@ -26,6 +26,11 @@ paths:
2626 content :
2727 application/json :
2828 schema : {}
29+ " 201 " :
30+ description : OK
31+ content :
32+ text/html :
33+ schema : {}
2934 /delete :
3035 delete :
3136 responses :
Original file line number Diff line number Diff line change 8686 }
8787 },
8888 {
89- "description" : " should error on unknown response content type" ,
89+ "description" : " should error on unknown response content type, per status code " ,
9090 "request" : {
9191 "method" : " GET" ,
9292 "path" : " /different-response-types"
Original file line number Diff line number Diff line change 8787 "code" : " response.content-type.incompatible" ,
8888 "message" : " Response Content-Type header is incompatible with the mime-types the spec defines to produce" ,
8989 "mockDetails" : {
90- "interactionDescription" : " should error on unknown response content type" ,
90+ "interactionDescription" : " should error on unknown response content type, per status code " ,
9191 "interactionState" : " [none]" ,
9292 "location" : " [root].interactions[6].response.headers.content-type" ,
9393 "value" : " text/html"
Original file line number Diff line number Diff line change @@ -24,17 +24,6 @@ export function* compareResHeader(
2424) : Iterable < Result > {
2525 const { method, oas, operation, path } = route . store ;
2626
27- const allAvailableResponseContentTypes =
28- operation . produces ||
29- Object . entries ( operation . responses ) . reduce (
30- ( acc : string [ ] , [ _status , response ] ) => {
31- return [
32- ...acc ,
33- ...Object . keys ( dereferenceOas ( response || { } , oas ) ?. content || { } ) ,
34- ] ;
35- } ,
36- [ ] ,
37- ) ;
3827 const availableResponseContentType =
3928 operation . produces ||
4029 Object . keys (
@@ -59,7 +48,7 @@ export function* compareResHeader(
5948 const responseContentType =
6049 responseHeaders . get ( "content-type" ) ?. split ( ";" ) [ 0 ] || "" ;
6150
62- if ( responseContentType && ! allAvailableResponseContentTypes . length ) {
51+ if ( responseContentType && ! availableResponseContentType . length ) {
6352 yield {
6453 code : "response.content-type.unknown" ,
6554 message :
You can’t perform that action at this time.
0 commit comments