Skip to content

How can I post json data? #191

@zacard-orc

Description

@zacard-orc

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions