Giter Site home page Giter Site logo

Comments (5)

emailstorbala avatar emailstorbala commented on September 22, 2024 1

@NotTheDr01ds Thank you for the http get -ef command information.
Without the authorisation headers, I was getting an output something like below:

image
With the auth headers, the original error starts appearing. I tried without 'Content-Type', 'Accept', with them and mixed. In all cases, I am getting the same error × MIME type unknown: application/hal+json;. Seems the http get command is not respecting our inputs in this case.

from nushell.

NotTheDr01ds avatar NotTheDr01ds commented on September 22, 2024

I may be wrong, but shouldn't that be Accept instead of Content-Type? curl sends a default Accept, which may explain why it's working with curl but not http get.

See this Stack Overflow answer for some more detail, including the suggestion of adding -v to the curl command to get more info.

from nushell.

emailstorbala avatar emailstorbala commented on September 22, 2024

@NotTheDr01ds Thank you for the information.
Seems 'Accept' header and 'Content-Type' headers are for different purposes and the same is explained in the below post.
https://stackoverflow.com/questions/35722586/http-headers-accept-and-content-type-in-a-rest-context

In my case, I need to set the 'Content-Type' header only in my request to emphasise that I send a json body (mostly used in put and post.) . For GET request, this parameter is not relevant, I guess. I use nevertheless :)

from nushell.

NotTheDr01ds avatar NotTheDr01ds commented on September 22, 2024

Agreed - that's what made me think Content-Type was out of place in this GET example ;-)

I would suggest comparing the output of curl -v to that of Nu's http get -ef. I'm hoping the problem (and hopefully the solution) will be apparent there.

from nushell.

devurandom avatar devurandom commented on September 22, 2024

I run into a similar problem. Making a request with HTTPie and bearer token succeeds, while making the same request with the same token using Nushell fails with an authentication error.

Is there a way to debug output the exact HTTP request that Nushell writes to the wire? To check where exactly the two differ?

from nushell.

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.