Ignore absent Response body definitions for HEAD requests

Issue #75 resolved
Vlad Vlasov created an issue

currently validator returns a warning that the pact mock expects Content-Type but spec does not produce any mime-types

{ code: 'response.content-type.unknown',
       message: 'Response Content-Type header is defined but the spec does not specify any mime-types to produce',
       mockDetails: 
        { interactionDescription: 'a request for checking the original file',
          interactionState: 'a valid token exists and e3287dfc-2c5b-499f-8851-c18a805282d7 is a file id',
          location: '[root].interactions[18].response.headers.Content-Type',
          mockFile: '../filestore/pacts/filestore-client-media-dt-api-filestore.json',
          value: 'binary/octet-stream' },
       source: 'spec-mock-validation',
       specDetails: 
        { location: '[root].paths./file/{fileId}/binary.head',
          pathMethod: 'head',
          pathName: '/file/{fileId}/binary',
          specFile: 'openapi.yaml',
          value: 
           { tags: [ 'files' ],
             responses: 
              { '200': 
                 { description: '',
                   headers: 
                    { 'Content-Length': { schema: { type: 'string' } },
                      'Content-Type': { schema: { type: 'string' } },
                      'Accept-Ranges': { schema: { type: 'string' } } } },
                '403': 
                 { description: 'not authorized',
                   content: 
                    { 'application/json': 
                       { schema: 
                          { type: 'object',
                            properties: 
                             { error: 
                                { type: 'object',
                                  properties: { message: { type: 'string' }, description: { type: 'string' } },
                                  required: [ 'message', 'description' ] } },
                            required: [ 'error' ] } } } },
                '404': { description: 'file not found' } },
             description: 'Get the headers for the original binary file. Useful for allowing clients to determine how large the file is (via the `Content-Length` header) and range request support (via `Accept-Ranges: bytes`).',
             operationId: 'HEAD_file-fileId-binary',
             parameters: 
              [ { name: 'collection',
                  in: 'query',
                  description: 'collection name to read an item from',
                  schema: { type: 'string' } } ] } },
       type: 'warning' }

but this is expected from HEAD request to produce relevant headers but not body as it is defined in https://tools.ietf.org/html/rfc7231#section-4.3.2

Comments (1)

  1. Log in to comment