我有以下部分lua脚本。
local config_string = [===[
]===]
local config = LuaConfig:new(config_string)
local request = LuaHttpRequest:new(config, "HTTP")
local username = "sss"
local password = "xxx"
request:set_header("Content-Type", "multipart/form-data")
request:set_header("Accept","application/json")
request:set_body("{\"RecordTitle\": { \"Value\": \"test vinay 344\" }, \"RecordRecordType\": \"2\", \"Fields\": { \"RoadSurface\" { \"Value\": \"smooth\" } } }")
request:set_url("http://ddddddd/CMServiceAPI/Record")如何执行基本身份验证?
发布于 2019-10-25 01:34:56
我不知道您使用的是哪个库,但大概是这样的:
local username = "sss"
local password = "xxx"
local mime = require("mime")
request:set_header("authentication", "Basic " .. (mime.b64(username ..":" .. password)) )
request:set_header("content-type", "application/json" )并在最后使用POST请求
https://stackoverflow.com/questions/58535075
复制相似问题