json postdata - WeOnlyDo Discussion board

json postdata (wodHttpDLX)

by shine, Monday, May 09, 2016, 01:54 (3121 days ago)
edited by shine, Monday, May 09, 2016, 02:18

it can't actually be sent as postdata on some servers

so when i try to just plug it a custom line in headers:

.Request.Headers.Add vbNewLine & "", "{""name"":""" & value & """}"

this is what request.headers.tostring returns errors

the problem is ": " is being added, as is customary when adding traditional header entries. this results in an error from the target server. and to reiterate, traditional "postdata" cannot be used here.

someone asked this question here before and wasn't given an answer, and that was years ago. many post requests require json post data

is this possible with wodhttp?

this is pretty standard web stuff in 2016. is there really no way to fully customize post requests? there must be.

json postdata

by Jasmine, Monday, May 09, 2016, 01:59 (3121 days ago) @ shine

Hi.

You cannot send JSON (or any other value) like that, not through Headers.Add.

It's sufficient to set
Request.Headers("Content-type").Value = "application/json"
and then in

Request.Body = your_json
with formatted JSON.

I hope this helps.

Jasmine

json postdata

by shine, Monday, May 09, 2016, 02:18 (3121 days ago) @ Jasmine

yeah that worked. awesome.