GithubHelp home page GithubHelp logo

Json with Post about http-request HOT 8 CLOSED

kevinsawicki avatar kevinsawicki commented on June 15, 2024
Json with Post

from http-request.

Comments (8)

kevinsawicki avatar kevinsawicki commented on June 15, 2024

Hi,

Have you tried with setting the content type to application/json instead of json?

What is the status code (.code()) of the request?

from http-request.

Kepler07 avatar Kepler07 commented on June 15, 2024

Thanks for your very fast answer.
I just try :
request = HttpRequest.post(url).contentType("application/json").basic("admin","Distech2013").send(params.toString());
Log.d("cordova", String.valueOf(request.code()));

and request.code() return 200.

from http-request.

kevinsawicki avatar kevinsawicki commented on June 15, 2024

So then it is working since you got a 200 response?

from http-request.

Kepler07 avatar Kepler07 commented on June 15, 2024

The request work but my server answer json missing.
There is a way to watch the body of my request. If i can see my body request i can debug my json or the request :)

from http-request.

kevinsawicki avatar kevinsawicki commented on June 15, 2024

You can print out the response body with request.body().

Just so you know, this library does not have built-in JSON conversion so the value of params.toString() must be valid JSON, which you could check by printing it out before you make the request.

from http-request.

Kepler07 avatar Kepler07 commented on June 15, 2024

I already see the response body, It's the request body i need to see but it's not possible with the plugin thanks for your answer i need to try some thing with my json.
I post if i have another probleme and thanks for your work.

from http-request.

kevinsawicki avatar kevinsawicki commented on June 15, 2024

The request body will just be the value of params.toString() since that is your only call to send()

from http-request.

kevinsawicki avatar kevinsawicki commented on June 15, 2024

Closing this out.

from http-request.

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.