Forum Discussion

loucast0159's avatar
loucast0159
Occasional Contributor
3 years ago

Accept header generated in lower case not working in "Try It Out" or with cURL

The "Try It Out" and cURL generated gives error on Accept Header.  

 

Seems the accept header is being generated with lower case.

With cURL when we change "accept" to "Accept" we get a proper response.

How can we make the header being generated as upper case initial letter ?

 

curl -X 'GET'  'https://host.com/cm/accounts/19415703 '  -H 'accept: application/json'  -H 'x-api-key: xxxxxx'  -H 'Authorization: Bearer xxxx'

 

We’re getting this error when trying out one of the methods in our sample API:

    {

      "code": null,

      "description": "Expected Accept in headers",

      "status": 400

    }

 

We cannot release the documentation to consumers with this problem.

Thanks in advance for your prompt response with a resolution to this. 

 

 

3 Replies

  • chichepo's avatar
    chichepo
    Champion Level 2

    Hi loucast0159

     

    I just want to recommend you to avoid posting real servers names even if you are checking access on your side 😉

    • loucast0159's avatar
      loucast0159
      Occasional Contributor

      Yes, absolutely.  My oversight, I had changed the text to a bogus host but not the link underneath.

       

      Thanks

  • loucast0159's avatar
    loucast0159
    Occasional Contributor

    Apologies everyone, it seems that the issue is with the API that we're calling.  Apparently it does the header validation in code and it only checks for "Accept" not "accept".  Unfortunately cannot change the code and still not sure how to pass the upprcase "Accept" through "Try It Out" but at least the mystery is solved.