Forum Discussion

shoaibalam's avatar
shoaibalam
New Contributor
7 years ago
Solved

Missing matching response for specified Accept header

I have an accept header 

 

- name: Accept
in: header
type: string
required: true
description: application/json; version=1.0.0
default: application/json; version=1.0.0

 

The corresponding Curl command is 

 

curl -X POST "https://virtserver.swaggerhub.com/SEG/Redemption/0.1/rewards" -H "accept: application/json" -H "Authorization: b2csegSSOApp1" -H "Accept: application/json; version=1.0.0" -H "Content-Type: application/json" -d "{ \"voucherSetupId\": 8797897}"

 

When I try to use Auto Mocking I am getting the following resposne:

 

{
  "message": "Missing matching response for specified Accept header"
}

Any help much appreciated.

 

  • Hi shoaibalam,

     

    The produces keyword is what defines the Accept header in requests. The Accept header is not supposed to be defined explicitly as a header parameter. Remove the Accept parameter and add the following instead:

    paths:
      /rewards:
        post:
          consumes:
            - application/json  # <-- Content-Type header
          produces:
            - application/json; version=1.0.0  # <-- Accept header

    Check out our OpenAPI 2.0 syntax guide for details:

    Describing Parameters

    MIME Types

2 Replies

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    Hi shoaibalam,

     

    The produces keyword is what defines the Accept header in requests. The Accept header is not supposed to be defined explicitly as a header parameter. Remove the Accept parameter and add the following instead:

    paths:
      /rewards:
        post:
          consumes:
            - application/json  # <-- Content-Type header
          produces:
            - application/json; version=1.0.0  # <-- Accept header

    Check out our OpenAPI 2.0 syntax guide for details:

    Describing Parameters

    MIME Types