@@ -32,10 +32,6 @@ function normalizeHttpMessage(message: any, event?: SubscribableEvent) {
3232 // We use raw headers where possible to derive headers, instead of using any pre-derived
3333 // header data, for maximum accuracy (and to avoid any need to query for both).
3434 message . headers = rawHeadersToObject ( message . rawHeaders ) ;
35- } else if ( message . headers ) {
36- // Backward compat for older servers:
37- message . headers = JSON . parse ( message . headers ) ;
38- message . rawHeaders = objectHeadersToRaw ( message . headers ) ;
3935 }
4036
4137 if ( message . rawTrailers ) {
@@ -236,19 +232,16 @@ export class MockttpAdminRequestBuilder {
236232
237233 ${ this . schema . asOptionalField ( 'InitiatedRequest' , 'destination' , 'destination { hostname, port }' ) }
238234
239- ${ this . schema . typeHasField ( 'InitiatedRequest' , 'rawHeaders' )
240- ? 'rawHeaders'
241- : 'headers'
242- }
235+ rawHeaders
243236 timingEvents
244237 httpVersion
245- ${ this . schema . asOptionalField ( 'InitiatedRequest' , ' tags' ) }
238+ tags
246239 }
247240 }` ,
248241 request : gql `subscription OnRequest {
249242 requestReceived {
250243 id
251- ${ this . schema . asOptionalField ( 'Request' , ' matchedRuleId' ) }
244+ matchedRuleId
252245 protocol
253246 method
254247 url
@@ -258,17 +251,13 @@ export class MockttpAdminRequestBuilder {
258251
259252 ${ this . schema . asOptionalField ( 'Request' , 'destination' , 'destination { hostname, port }' ) }
260253
261- ${ this . schema . typeHasField ( 'Request' , 'rawHeaders' )
262- ? 'rawHeaders'
263- : 'headers'
264- }
265-
254+ rawHeaders
266255 body
267256 ${ this . schema . asOptionalField ( 'Request' , 'rawTrailers' ) }
268257
269- ${ this . schema . asOptionalField ( 'Request' , ' timingEvents' ) }
270- ${ this . schema . asOptionalField ( 'Request' , ' httpVersion' ) }
271- ${ this . schema . asOptionalField ( 'Request' , ' tags' ) }
258+ timingEvents
259+ httpVersion
260+ tags
272261 }
273262 }` ,
274263 response : gql `subscription OnResponse {
@@ -277,16 +266,12 @@ export class MockttpAdminRequestBuilder {
277266 statusCode
278267 statusMessage
279268
280- ${ this . schema . typeHasField ( 'Response' , 'rawHeaders' )
281- ? 'rawHeaders'
282- : 'headers'
283- }
284-
269+ rawHeaders
285270 body
286271 ${ this . schema . asOptionalField ( 'Response' , 'rawTrailers' ) }
287272
288- ${ this . schema . asOptionalField ( 'Response' , ' timingEvents' ) }
289- ${ this . schema . asOptionalField ( 'Response' , ' tags' ) }
273+ timingEvents
274+ tags
290275 }
291276 }` ,
292277 'websocket-request' : gql `subscription OnWebSocketRequest {
@@ -370,14 +355,12 @@ export class MockttpAdminRequestBuilder {
370355
371356 ${ this . schema . asOptionalField ( 'AbortedRequest' , 'destination' , 'destination { hostname, port }' ) }
372357
373- ${ this . schema . typeHasField ( 'Request' , ' rawHeaders' )
374- ? 'rawHeaders'
375- : 'headers'
376- }
358+ rawHeaders
359+
360+ timingEvents
361+ tags
377362
378- ${ this . schema . asOptionalField ( 'Request' , 'timingEvents' ) }
379- ${ this . schema . asOptionalField ( 'Request' , 'tags' ) }
380- ${ this . schema . asOptionalField ( 'AbortedRequest' , 'error' ) }
363+ error
381364 }
382365 }` ,
383366 'tls-passthrough-opened' : gql `subscription OnTlsPassthroughOpened {
@@ -397,7 +380,7 @@ export class MockttpAdminRequestBuilder {
397380 remotePort
398381 tags
399382 timingEvents
400- ${ this . schema . asOptionalField ( 'TlsPassthroughEvent' , ' tlsMetadata' ) }
383+ tlsMetadata
401384 }
402385 }` ,
403386 'tls-passthrough-closed' : gql `subscription OnTlsPassthroughClosed {
@@ -417,18 +400,18 @@ export class MockttpAdminRequestBuilder {
417400 remotePort
418401 tags
419402 timingEvents
420- ${ this . schema . asOptionalField ( 'TlsPassthroughEvent' , ' tlsMetadata' ) }
403+ tlsMetadata
421404 }
422405 }` ,
423406 'tls-client-error' : gql `subscription OnTlsClientError {
424407 failedTlsRequest {
425408 failureCause
426409 hostname
427410 remoteIpAddress
428- ${ this . schema . asOptionalField ( [ 'TlsHandshakeFailure' , 'TlsRequest' ] , ' remotePort' ) }
429- ${ this . schema . asOptionalField ( [ 'TlsHandshakeFailure' , 'TlsRequest' ] , ' tags' ) }
430- ${ this . schema . asOptionalField ( [ 'TlsHandshakeFailure' , 'TlsRequest' ] , ' timingEvents' ) }
431- ${ this . schema . asOptionalField ( [ 'TlsHandshakeFailure' , 'TlsRequest' ] , ' tlsMetadata' ) }
411+ remotePort
412+ tags
413+ timingEvents
414+ tlsMetadata
432415 }
433416 }` ,
434417 'client-error' : gql `subscription OnClientError {
@@ -444,10 +427,7 @@ export class MockttpAdminRequestBuilder {
444427 url
445428 path
446429
447- ${ this . schema . typeHasField ( 'ClientErrorRequest' , 'rawHeaders' )
448- ? 'rawHeaders'
449- : 'headers'
450- }
430+ rawHeaders
451431
452432 ${ this . schema . asOptionalField ( 'ClientErrorRequest' , 'remoteIpAddress' ) }
453433 ${ this . schema . asOptionalField ( 'ClientErrorRequest' , 'remotePort' ) }
@@ -460,10 +440,7 @@ export class MockttpAdminRequestBuilder {
460440 statusCode
461441 statusMessage
462442
463- ${ this . schema . typeHasField ( 'Response' , 'rawHeaders' )
464- ? 'rawHeaders'
465- : 'headers'
466- }
443+ rawHeaders
467444
468445 body
469446 ${ this . schema . asOptionalField ( 'Response' , 'rawTrailers' ) }
@@ -567,16 +544,13 @@ export class MockttpAdminRequestBuilder {
567544 path,
568545 hostname
569546
570- ${ this . schema . typeHasField ( 'Request' , 'rawHeaders' )
571- ? 'rawHeaders'
572- : 'headers'
573- }
547+ rawHeaders
574548
575549 body,
576- ${ this . schema . asOptionalField ( 'Request' , ' timingEvents' ) }
577- ${ this . schema . asOptionalField ( 'Request' , ' httpVersion' ) }
550+ timingEvents
551+ httpVersion
578552 }
579- ${ this . schema . asOptionalField ( 'MockedEndpoint' , ' isPending' ) }
553+ isPending
580554 }
581555 }
582556 ` ,
0 commit comments