@@ -97,32 +97,8 @@ export function* compareResHeader(
9797 }
9898 responseHeaders . delete ( "content-type" ) ;
9999
100- // standard headers
101- // ----------------
102- for ( const headerName of standardHttpResponseHeaders ) {
103- if ( responseHeaders . has ( headerName ) ) {
104- yield {
105- code : "response.header.undefined" ,
106- message : `Standard http response header is not defined in the spec file: ${ headerName } ` ,
107- mockDetails : {
108- ...baseMockDetails ( interaction ) ,
109- location : `[root].interactions[${ index } ].response.headers.${ headerName } ` ,
110- value : get ( interaction , "request.headers" ) ,
111- } ,
112- specDetails : {
113- location : `[root].paths.${ path } .${ method } ` ,
114- pathMethod : method ,
115- pathName : path ,
116- value : operation ,
117- } ,
118- type : "warning" ,
119- } ;
120- }
121- responseHeaders . delete ( headerName ) ;
122- }
123-
124- // other headers
125- // -------------
100+ // specified headers
101+ // -----------------
126102 const headers =
127103 dereferenceOas ( operation . responses [ interaction . response . status ] || { } , oas )
128104 ?. headers || { } ;
@@ -161,6 +137,32 @@ export function* compareResHeader(
161137 responseHeaders . delete ( headerName ) ;
162138 }
163139
140+ // standard headers
141+ // ----------------
142+ for ( const headerName of standardHttpResponseHeaders ) {
143+ if ( responseHeaders . has ( headerName ) ) {
144+ yield {
145+ code : "response.header.undefined" ,
146+ message : `Standard http response header is not defined in the spec file: ${ headerName } ` ,
147+ mockDetails : {
148+ ...baseMockDetails ( interaction ) ,
149+ location : `[root].interactions[${ index } ].response.headers.${ headerName } ` ,
150+ value : get ( interaction , "request.headers" ) ,
151+ } ,
152+ specDetails : {
153+ location : `[root].paths.${ path } .${ method } ` ,
154+ pathMethod : method ,
155+ pathName : path ,
156+ value : operation ,
157+ } ,
158+ type : "warning" ,
159+ } ;
160+ }
161+ responseHeaders . delete ( headerName ) ;
162+ }
163+
164+ // remaining headers
165+ // -----------------
164166 for ( const [ headerName , headerValue ] of responseHeaders . entries ( ) ) {
165167 yield {
166168 code : "response.header.unknown" ,
0 commit comments