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

How can I post json data? #191

Open
zacard-orc opened this issue Jan 30, 2024 · 1 comment
Open

How can I post json data? #191

zacard-orc opened this issue Jan 30, 2024 · 1 comment

Comments

@zacard-orc
Copy link

I browsed the official document,but i can't found any info about postjson.

I try this way,but no effect,

local post_data = {
   sn = sn
}
local headers = {}
headers["Content-Type"] = "application/json;charset=utf-8"
headers["Accept"] = "application/json"

local postdata_json = json.encode(post_data)
c:setopt_httpheader(headers)
c:setopt_postfields(postdata_json)
c:setopt_writefunction(function(response_data)
   alert(response_data) 
end)

c:perform()
c:close()

can u help me ,give a sample?

@NTBBloodbath
Copy link

NTBBloodbath commented Jan 30, 2024

Hey buddy, did you try adding c:setopt_post(true) somewhere already?

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

2 participants