httpclient
简介
组件接口
httpclient.gs
multipart.gs
函数原型 | 函数作用 |
---|---|
map parse(buffer content, string boundary) | 将 multipart/form-data 格式的数据解析为 map |
raw_transmit.gs
函数原型 | 函数作用 |
---|---|
ErrorCode get_socket_code() | 获取 socket 的状态码 |
request.gs
函数原型 | 函数作用 |
---|---|
void set_socket_code(ErrorCode code) | 设置socket返回的错误码 |
ErrorCode get_socket_code() | 获取socket返回的错误码 |
枚举
Response_Code
HTTP 请求放回状态码, 这里只有常用的
更详细的介绍
init,
switching_protocols = 101, // 101 Switching Protocals
ok = 200, // 200 Ok
created = 201, // 201 Created
accepted = 202, // 202 Accepted
no_content = 204, // 204 No Content
partial_content = 206, // 206 Partial Content
multiple_choices = 300, // 300 Multiple Choices
moved_permanently = 301, // 301 Moved Permanently
moved_temporarily = 302, // 307 Temporary Redirect
not_modified = 304, // 302 Moved Temporarily
temporary_redirect = 307, // 304 Not Modified
bad_request = 400, // 400 Bad Request
unauthorized = 401, // 401 Unauthorized
forbidden = 403, // 403 Forbidden
not_found = 404, // 404 Not Found
internal_server_error = 500, // 500 Internal Server Error
not_implemented = 501, // 501 Not Implemented
bad_gateway = 502, // 502 Bad Gateway
service_unavailable = 503 // 503 Service Unavailable
content_encoding
http 是否进行压缩, 目前没有支持
gzip,
none
Content_Type
使用 post 发送 http 请求时, body 的是如何序列化和反序列话的
gs_buffer 理论和 stream 是一样的, 只不过是说法不一样, 使用这种方式, 序列化方法是 gs 内置的 save_buffer
stream,
html,
json,
plain,
multipart,
gs_buffer,
urlencoded,
msgpack,
none,