cancel
Showing results for 
Search instead for 
Did you mean: 

Missing matching response for specified Accept header

SOLVED
shoaibalam
New Contributor

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.

 

1 ACCEPTED SOLUTION

Accepted Solutions
HKosova
Moderator

Re: Missing matching response for specified Accept header

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


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

2 REPLIES 2
HKosova
Moderator

Re: Missing matching response for specified Accept header

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


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

shoaibalam
New Contributor

Re: Missing matching response for specified Accept header

Thanks for the solution. It worked.

New Here?
Join us and watch the welcome video: