Giter VIP home page Giter VIP logo

Comments (9)

ardatan avatar ardatan commented on May 14, 2024 1

Available in v0.1.16!

from graphql-mesh.

ardatan avatar ardatan commented on May 14, 2024

I think you need to overwrite headers. So you can add your own headers using operationHeaders mesh config. And add content-type with */*.

from graphql-mesh.

donedgardo avatar donedgardo commented on May 14, 2024

How can I debug if the operation is using the correct request headers. Added the operationHeaders but still same error.

from graphql-mesh.

ardatan avatar ardatan commented on May 14, 2024

You can compare the request coming from Mesh and working another one you send.

from graphql-mesh.

sviatoslav-lebediev avatar sviatoslav-lebediev commented on May 14, 2024

I have the same issue, my external server returns application/vnd.api+json; charset=utf-8 instead of application/json. I've tried to add operationHeaders, no luck.
Error

Unexpected error value: \"Operation GET /applications should 
have a content-type 'application/json' but 
has 'application/vnd.api+json; charset=utf-8' instead\"

from graphql-mesh.

ardatan avatar ardatan commented on May 14, 2024

Could you share your mesh configuration @sviatoslav-lebediev ?

from graphql-mesh.

sviatoslav-lebediev avatar sviatoslav-lebediev commented on May 14, 2024

Sure, I've tried different variations but got the same error.

sources:                                                                                                                                                        - name: bakery
    handler:                                                                                                                                                      
      openapi:
        baseUrl: https://bakery.dev.host.net/api/v1
        source: ./swagger.json
        operationHeaders:
            Content-type: "*/*"
            Accept: "*/*"
            Authorization: ....

and

sources:                                                                                                                                                        - name: bakery
    handler:                                                                                                                                                      
      openapi:
        baseUrl: https://bakery.dev.host.net/api/v1
        source: ./swagger.json
        operationHeaders:
            Content-type: application/vnd.api+json; charset=utf-8
            Accept: application/vnd.api+json; charset=utf-8
            Authorization: .... 

I've tried lowercase Content-type and Accept as well.

from graphql-mesh.

denizkenan avatar denizkenan commented on May 14, 2024

Same error with stackexchange api(openapi 2.0)
query:

{
  getQuestions(site:"stackoverflow")
}

response:

{
  "errors": [
    {
      "message": "Unexpected error value: \"Operation GET /questions should have a content-type '*/*' but has 'application/json; charset=utf-8' instead\"",
      "locations": [],
      "path": [
        "getQuestions"
      ]
    }
  ],
  "data": {
    "getQuestions": null
  }
}

example:
https://codesandbox.io/s/stackexchange-apiguru-m6j5x

Note: corresponding API can be tested via running yarn swagger with in shared codesandbox

from graphql-mesh.

denizkenan avatar denizkenan commented on May 14, 2024

#248 (comment)
FYI -> my issue is resolved after #358

Thanks!

from graphql-mesh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.