File tree Expand file tree Collapse file tree 5 files changed +37
-55
lines changed
Expand file tree Collapse file tree 5 files changed +37
-55
lines changed Original file line number Diff line number Diff line change 140140 "code" : " response.status.default" ,
141141 "message" : " Response status code matched default response in spec file: 200" ,
142142 "mockDetails" : {
143- "interactionDescription" : " should error based on default response" ,
143+ "interactionDescription" : " should use default response" ,
144144 "interactionState" : " [none]" ,
145145 "location" : " [root].interactions[6].response.status" ,
146146 "value" : 200
161161 },
162162 "content" : {
163163 "application/json" : {
164- "schema" : {}
164+ "schema" : {
165+ "type" : " object" ,
166+ "properties" : {
167+ "name" : {
168+ "type" : " string"
169+ }
170+ }
171+ }
165172 }
166173 }
167174 }
Original file line number Diff line number Diff line change 4848 type : number
4949 content :
5050 application/json :
51- schema : {}
51+ schema :
52+ type : object
53+ properties :
54+ name :
55+ type : string
Original file line number Diff line number Diff line change 8686 }
8787 },
8888 {
89- "description" : " should error based on default response" ,
89+ "description" : " should use default response" ,
9090 "request" : {
9191 "method" : " GET" ,
9292 "path" : " /default"
9696 "headers" : {
9797 "Content-Type" : " application/json" ,
9898 "specified" : " 5"
99+ },
100+ "body" : {
101+ "name" : " name"
99102 }
100103 }
101104 },
Original file line number Diff line number Diff line change 130130 },
131131 "type" : " error"
132132 },
133- {
134- "code" : " response.content-type.unknown" ,
135- "message" : " Response Content-Type header is defined but the spec does not specify any mime-types to produce" ,
136- "mockDetails" : {
137- "interactionDescription" : " should error based on default response" ,
138- "interactionState" : " [none]" ,
139- "location" : " [root].interactions[6].response.headers.content-type" ,
140- "value" : " application/json"
141- },
142- "specDetails" : {
143- "location" : " [root].paths./default.get" ,
144- "pathMethod" : " get" ,
145- "pathName" : " /default" ,
146- "value" : {
147- "responses" : {
148- "default" : {
149- "description" : " OK" ,
150- "headers" : {
151- "specified" : {
152- "schema" : {
153- "type" : " number"
154- }
155- }
156- },
157- "content" : {
158- "application/json" : {
159- "schema" : {}
160- }
161- }
162- }
163- }
164- }
165- },
166- "type" : " warning"
167- },
168133 {
169134 "code" : " response.status.default" ,
170135 "message" : " Response status code matched default response in spec file: 200" ,
171136 "mockDetails" : {
172- "interactionDescription" : " should error based on default response" ,
137+ "interactionDescription" : " should use default response" ,
173138 "interactionState" : " [none]" ,
174139 "location" : " [root].interactions[6].response.status" ,
175140 "value" : 200
190155 },
191156 "content" : {
192157 "application/json" : {
193- "schema" : {}
158+ "schema" : {
159+ "type" : " object" ,
160+ "properties" : {
161+ "name" : {
162+ "type" : " string"
163+ }
164+ }
165+ }
194166 }
195167 }
196168 }
Original file line number Diff line number Diff line change @@ -24,29 +24,25 @@ export function* compareResHeader(
2424) : Iterable < Result > {
2525 const { method, oas, operation, path } = route . store ;
2626
27- const availableResponseContentType =
28- operation . produces ||
29- Object . keys (
30- dereferenceOas (
31- operation . responses [ interaction . response . status ] || { } ,
32- oas ,
33- ) ?. content || { } ,
34- ) ;
35- const responseHeaders = new Headers (
36- interaction . response . headers as Record < string , string > ,
37- ) ;
38-
39- // no response found
40- // -----------------
4127 const response =
4228 operation . responses [ interaction . response . status ] ||
4329 operation . responses [ "default" ] ;
30+
31+ // no response found
32+ // -----------------
4433 if ( ! response ) {
4534 return ;
4635 }
4736
4837 // response content-type
4938 // ---------------------
39+ const availableResponseContentType =
40+ operation . produces ||
41+ Object . keys ( dereferenceOas ( response || { } , oas ) ?. content || { } ) ;
42+ const responseHeaders = new Headers (
43+ interaction . response . headers as Record < string , string > ,
44+ ) ;
45+
5046 const responseContentType =
5147 responseHeaders . get ( "content-type" ) ?. split ( ";" ) [ 0 ] || "" ;
5248
You can’t perform that action at this time.
0 commit comments