Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP post request not returning valid data #41

Open
zaindroid opened this issue Apr 22, 2021 · 0 comments
Open

HTTP post request not returning valid data #41

zaindroid opened this issue Apr 22, 2021 · 0 comments

Comments

@zaindroid
Copy link

zaindroid commented Apr 22, 2021

Hi, I am trying to use this http client example but I am not able to visualize the data received, I am able to receive and parse JSON data on post request without header but when I add header , which is required for this one particular request the buffer shows no data , while param.message shows ?????? in terminal.

Following is my request format

`struct FetchParams dataStruct;
dataStruct.OnDataRcv =OnDataRcv;
dataStruct.method=Post;
Header headerContentType = {
.key="Content-Type",
.val="Application/json"

   };
   Header headerAuth = {
      .key="Authorization",
      .val=(char *)my_authCode
      //.val="Bearer 249174ddf663787f4ea605e5ef3c4996c03601543e5994a0d422adbe397c8d9e971560149708740"
      
   };
    
    dataStruct.header[0]=headerAuth;
    dataStruct.header[1]=headerContentType;
    char buffer[300];
    requestBody(clientId,authToken,buffer);
    dataStruct.body=buffer;
    fetch("https://api.test.fyta-app.de/hub/auth",&dataStruct);`

I have checked with postman , it returns the following output data

{
"access_token": "170ea98ce3fb4f7fc0955a3277e5f0ab9c9d3abad59b435553d36f11b0c81b2b731618926240929",
"token_type": "Bearer",
"expires_in": 86400,
"refresh_token": "17b52fd903fec46f884fa5a1431f30a7f5556663408b9a521bfa6437254731f4ec1618926240930",
"scope": "hub"
}

I am also attaching output on terminal,
Screenshot 2021-04-22 064245

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant