6.3.0 - 新增 ocr / notice / s13n / Color 模块; 新增前台时保持屏幕常亮; 修复构建脚本依赖; 修复并优化控制台浮动窗口

This commit is contained in:
SuperMonster003
2023-04-29 20:07:53 +08:00
parent e2922cf8f5
commit 6ff598d587
511 changed files with 55015 additions and 11139 deletions

View File

@@ -2,10 +2,12 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>HTTP | AutoJs6 文档 - 6.2.0</title>
<title>HTTP | AutoJs6 文档 - 6.3.0</title>
<link rel="stylesheet" href="assets/fonts.css">
<link rel="stylesheet" href="assets/style.css">
<link rel="stylesheet" href="assets/sh.css">
<link rel="stylesheet" href="plugins/docsify-copy-code@2-styles.css">
<link rel="stylesheet" href="plugins/zoom-image-styles.css">
<link rel="canonical" href="https://nodejs.org/api/http.html">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport" content="user-scalable=no">
@@ -21,15 +23,14 @@
<ul>
<li><a class="nav-overview" href="overview.html">Overview - 综述</a></li>
<li><a class="nav-documentation" href="documentation.html">About - 关于文档</a></li>
<li><a class="nav-progress" href="progress.html">Progress - 完善进度</a></li>
<li><a class="nav-changelog" href="changelog.html">Changelog - 更新日志</a></li>
<li><a class="nav-qa" href="qa.html">Q&amp;A - 疑难解答</a></li>
<li><a class="nav-progress" href="progress.html">Progress - 文档部署进度</a></li>
<li><a class="nav-changelog" href="changelog.html">Changelog - 文档更新日志</a></li>
</ul>
<div class="line"></div>
<ul>
<li><a class="nav-http actives-developer-mozilla-org-zh-CN-docs-Web-JavaScript-" href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/">MDN - JavaScript 基础</a></li>
<li><a class="nav-https-zh-javascript-info-" href="https://zh.javascript.info/">JavaScript.info - JavaScript 教程</a></li>
<li><a class="nav-manual" href="manual.html">Manual - AutoJs6 使用手册</a></li>
<li><a class="nav-qa" href="qa.html">Q &amp; A - 疑难解答</a></li>
</ul>
<div class="line"></div>
@@ -40,6 +41,7 @@
<li><a class="nav-app" href="app.html">App - 通用应用</a></li>
<li><a class="nav-color" href="color.html">Color - 颜色</a></li>
<li><a class="nav-image" href="image.html">Image - 图像</a></li>
<li><a class="nav-ocr" href="ocr.html">OCR - 光学字符识别</a></li>
<li><a class="nav-keys" href="keys.html">Keys - 按键</a></li>
<li><a class="nav-device" href="device.html">Device - 设备</a></li>
<li><a class="nav-storages" href="storages.html">Storage - 储存</a></li>
@@ -48,6 +50,8 @@
<li><a class="nav-tasks" href="tasks.html">Task - 任务</a></li>
<li><a class="nav-modules" href="modules.html">Module - 模块</a></li>
<li><a class="nav-plugins" href="plugins.html">Plugins - 插件</a></li>
<li><a class="nav-toast" href="toast.html">Toast - 消息浮动框</a></li>
<li><a class="nav-notice" href="notice.html">Notice - 消息通知</a></li>
<li><a class="nav-console" href="console.html">Console - 控制台</a></li>
<li><a class="nav-shell" href="shell.html">Shell</a></li>
<li><a class="nav-media" href="media.html">Media - 多媒体</a></li>
@@ -62,16 +66,32 @@
<li><a class="nav-canvas" href="canvas.html">Canvas - 画布</a></li>
<li><a class="nav-ui" href="ui.html">UI - 用户界面</a></li>
<li><a class="nav-web" href="web.html">Web - 万维网</a></li>
<li><a class="nav-http" href="http.html">HTTP</a></li>
<li><a class="nav-http active" href="http.html">HTTP</a></li>
<li><a class="nav-base64" href="base64.html">Base64</a></li>
<li><a class="nav-crypto" href="crypto.html">Crypto - 密文</a></li>
<li><a class="nav-i18n" href="i18n.html">Internationalization - 国际化</a></li>
<li><a class="nav-s13n" href="s13n.html">Standardization - 标准化</a></li>
<li><a class="nav-e4x" href="e4x.html">E4X</a></li>
</ul>
<div class="line"></div>
<ul>
<li><a class="nav-glossaries" href="glossaries.html">Glossaries - 术语</a></li>
<li><a class="nav-uiSelectorType" href="uiSelectorType.html">UiSelector - 选择器</a></li>
<li><a class="nav-uiObjectType" href="uiObjectType.html">UiObject - 控件节点</a></li>
<li><a class="nav-uiObjectCollectionType" href="uiObjectCollectionType.html">UiObjectCollection - 控件集合</a></li>
<li><a class="nav-uiObjectActionsType" href="uiObjectActionsType.html">UiObjectActions - 控件节点行为</a></li>
<li><a class="nav-imageWrapper" href="imageWrapper.html">ImageWrapper - 包装图像类</a></li>
<li><a class="nav-appType" href="appType.html">App - 应用枚举类</a></li>
<li><a class="nav-colorType" href="colorType.html">Color - 颜色类</a></li>
<li><a class="nav-versionType" href="versionType.html">Version - 版本工具类</a></li>
<li><a class="nav-polyfill" href="polyfill.html">Polyfill - 代码填泥</a></li>
<li><a class="nav-arrayx" href="arrayx.html">Arrayx - Array 扩展</a></li>
<li><a class="nav-numberx" href="numberx.html">Numberx - Number 扩展</a></li>
<li><a class="nav-mathx" href="mathx.html">Mathx - Math 扩展</a></li>
</ul>
<div class="line"></div>
<ul>
<li><a class="nav-exceptions" href="exceptions.html">Exceptions - 异常</a></li>
<li><a class="nav-intentType" href="intentType.html">Intent - 意图</a></li>
<li><a class="nav-runtime" href="runtime.html">Runtime - 运行时</a></li>
@@ -80,25 +100,6 @@
</ul>
<div class="line"></div>
<ul>
<li><a class="nav-dataTypes" href="dataTypes.html">Data Types - 数据类型</a></li>
<li><a class="nav-uiSelectorType" href="uiSelectorType.html">UiSelector - 选择器</a></li>
<li><a class="nav-uiObjectType" href="uiObjectType.html">UiObject - 控件节点</a></li>
<li><a class="nav-uiObjectCollectionType" href="uiObjectCollectionType.html">UiObjectCollection - 控件集合</a></li>
<li><a class="nav-uiObjectActionsType" href="uiObjectActionsType.html">UiObjectActions - 控件节点行为</a></li>
<li><a class="nav-appType" href="appType.html">App - 应用枚举类</a></li>
<li><a class="nav-versionType" href="versionType.html">Version - 版本工具类</a></li>
</ul>
<div class="line"></div>
<ul>
<li><a class="nav-polyfill" href="polyfill.html">Polyfill - 代码填泥</a></li>
<li><a class="nav-arrayx" href="arrayx.html">Arrayx - Array 扩展</a></li>
<li><a class="nav-numberx" href="numberx.html">Numberx - Number 扩展</a></li>
<li><a class="nav-mathx" href="mathx.html">Mathx - Math 扩展</a></li>
</ul>
<div class="line"></div>
<ul>
<li><a class="nav-scriptingJava" href="scriptingJava.html">Scripting Java - 脚本化 Java</a></li>
<li><a class="nav-apiLevel" href="apiLevel.html">Android API Level - 安卓 API 级别</a></li>
@@ -107,15 +108,51 @@
<div class="line"></div>
<ul>
<li><a class="nav-https-github-com-SuperMonster003-AutoJs6-" href="https://github.com/SuperMonster003/AutoJs6/">GitHub - 应用项目地址</a></li>
<li><a class="nav-https-github-com-SuperMonster003-AutoJs6-Documentation" href="https://github.com/SuperMonster003/AutoJs6-Documentation">GitHub - 文档项目地址</a></li>
<li><a class="nav-glossaries" href="glossaries.html">Glossaries - 术语</a></li>
<li><a class="nav-httpHeaderGlossary" href="httpHeaderGlossary.html">HttpHeader - HTTP 标头</a></li>
<li><a class="nav-httpRequestMethodsGlossary" href="httpRequestMethodsGlossary.html">HttpRequestMethods - HTTP 请求方法</a></li>
<li><a class="nav-mimeTypeGlossary" href="mimeTypeGlossary.html">MimeType - MIME 类型</a></li>
<li><a class="nav-notificationChannelGlossary" href="notificationChannelGlossary.html">NotificationChannel - 通知渠道</a></li>
</ul>
<div class="line"></div>
<ul>
<li><a class="nav-dataTypes" href="dataTypes.html">Data Types - 数据类型</a></li>
<li><a class="nav-omniTypes" href="omniTypes.html">Omnipotent Types - 全能类型</a></li>
<li><a class="nav-storageType" href="storageType.html">Storage - 存储类</a></li>
<li><a class="nav-androidBundleType" href="androidBundleType.html">AndroidBundle</a></li>
<li><a class="nav-androidRectType" href="androidRectType.html">AndroidRect</a></li>
<li><a class="nav-consoleBuildOptionsType" href="consoleBuildOptionsType.html">ConsoleBuildOptions</a></li>
<li><a class="nav-httpRequestBuilderOptionsType" href="httpRequestBuilderOptionsType.html">HttpRequestBuilderOptions</a></li>
<li><a class="nav-httpRequestHeadersType" href="httpRequestHeadersType.html">HttpRequestHeaders</a></li>
<li><a class="nav-httpResponseBodyType" href="httpResponseBodyType.html">HttpResponseBody</a></li>
<li><a class="nav-httpResponseHeadersType" href="httpResponseHeadersType.html">HttpResponseHeaders</a></li>
<li><a class="nav-httpResponseType" href="httpResponseType.html">HttpResponse</a></li>
<li><a class="nav-injectableWebClientType" href="injectableWebClientType.html">InjectableWebClient</a></li>
<li><a class="nav-injectableWebViewType" href="injectableWebViewType.html">InjectableWebView</a></li>
<li><a class="nav-noticeOptionsType" href="noticeOptionsType.html">NoticeOptions</a></li>
<li><a class="nav-noticeChannelOptionsType" href="noticeChannelOptionsType.html">NoticeChannelOptions</a></li>
<li><a class="nav-noticePresetConfigurationType" href="noticePresetConfigurationType.html">NoticePresetConfiguration</a></li>
<li><a class="nav-noticeBuilderType" href="noticeBuilderType.html">NoticeBuilder</a></li>
<li><a class="nav-okhttp3HttpUrlType" href="okhttp3HttpUrlType.html">Okhttp3HttpUrl</a></li>
<li><a class="nav-ocrOptionsType" href="ocrOptionsType.html">OcrOptions</a></li>
<li><a class="nav-okhttp3RequestType" href="okhttp3RequestType.html">Okhttp3Request</a></li>
<li><a class="nav-opencvPointType" href="opencvPointType.html">OpencvPoint</a></li>
<li><a class="nav-opencvRectType" href="opencvRectType.html">OpencvRect</a></li>
<li><a class="nav-opencvSizeType" href="opencvSizeType.html">OpencvSize</a></li>
</ul>
<div class="line"></div>
<ul>
<li><a class="nav-http-project-autojs6-com" href="http://project.autojs6.com">GitHub - 应用项目地址</a></li>
<li><a class="nav-http-docs-project-autojs6-com" href="http://docs-project.autojs6.com">GitHub - 文档项目地址</a></li>
</ul>
</div>
<div id="column1" data-id="http" class="interior">
<header>
<h1>AutoJs6 文档 - 6.2.0</h1>
<h1>AutoJs6 文档 - 6.3.0</h1>
<div id="gtoc">
<p class="index">
<a href="index.html" name="toc">索引</a> |
@@ -129,21 +166,30 @@
<h2>目录</h2>
<ul>
<li><span class="stability_undefined"><a href="#http_http">HTTP</a></span><ul>
<li><span class="stability_undefined"><a href="#http_http_get_url_options_callback">http.get(url[, options, callback])</a></span></li>
<li><span class="stability_undefined"><a href="#http_http_post_url_data_options_callback">http.post(url, data[, options, callback])</a></span></li>
<li><span class="stability_undefined"><a href="#http_http_postjson_url_data_options_callback">http.postJson(url[, data, options, callback])</a></span></li>
<li><span class="stability_undefined"><a href="#http_http_postmultipart_url_files_options_callback">http.postMultipart(url, files[, options, callback])</a></span></li>
<li><span class="stability_undefined"><a href="#http_http_request_url_options_callback">http.request(url[, options, callback])</a></span></li>
<li><span class="stability_undefined"><a href="#http_m_get">[m] get</a></span><ul>
<li><span class="stability_undefined"><a href="#http_get_url_options_callback">get(url, options?, callback?)</a></span></li>
</ul>
</li>
<li><span class="stability_undefined"><a href="#http_m_post">[m] post</a></span><ul>
<li><span class="stability_undefined"><a href="#http_post_url_data_options_callback">post(url, data, options?, callback?)</a></span></li>
</ul>
</li>
<li><span class="stability_undefined"><a href="#http_m_postjson">[m] postJson</a></span><ul>
<li><span class="stability_undefined"><a href="#http_postjson_url_data_options_callback">postJson(url, data?, options?, callback?)</a></span></li>
</ul>
</li>
<li><span class="stability_undefined"><a href="#http_m_postmultipart">[m] postMultipart</a></span><ul>
<li><span class="stability_undefined"><a href="#http_postmultipart_url_files_options_callback">postMultipart(url, files, options?, callback?)</a></span></li>
</ul>
</li>
<li><span class="stability_undefined"><a href="#http_m_request">[m] request</a></span><ul>
<li><span class="stability_undefined"><a href="#http_request_url_options_callback">request(url, options?, callback?)</a></span></li>
</ul>
</li>
<li><span class="stability_undefined"><a href="#http_m_buildrequest">[m] buildRequest</a></span><ul>
<li><span class="stability_undefined"><a href="#http_buildrequest_url_options">buildRequest(url, options)</a></span></li>
</ul>
</li>
<li><span class="stability_undefined"><a href="#http_response">Response</a></span><ul>
<li><span class="stability_undefined"><a href="#http_response_statuscode">Response.statusCode</a></span></li>
<li><span class="stability_undefined"><a href="#http_response_statusmessage">Response.statusMessage</a></span></li>
<li><span class="stability_undefined"><a href="#http_response_headers">Response.headers</a></span></li>
<li><span class="stability_undefined"><a href="#http_response_body">Response.body</a></span></li>
<li><span class="stability_undefined"><a href="#http_response_request">Response.request</a></span></li>
<li><span class="stability_undefined"><a href="#http_response_url">Response.url</a></span></li>
<li><span class="stability_undefined"><a href="#http_response_method">Response.method</a></span></li>
</ul>
</li>
</ul>
@@ -154,11 +200,15 @@
<h1>HTTP<span><a class="mark" href="#http_http" id="http_http">#</a></span></h1>
<hr>
<p style="font: italic 1em sans-serif; color: #78909C">此章节待补充或完善...</p>
<p style="font: italic 1em sans-serif; color: #78909C">Marked by SuperMonster003 on Oct 22, 2022.</p>
<p style="font: italic 1em sans-serif; color: #78909C">Marked by SuperMonster003 on Mar 21, 2023.</p>
<hr>
<p>http模块提供一些进行http请求的函数.</p>
<h2>http.get(url[, options, callback])<span><a class="mark" href="#http_http_get_url_options_callback" id="http_http_get_url_options_callback">#</a></span></h2>
<blockquote>
<p>注: 与 <a href="web.html">web</a> 模块不同, web 模块主要用于 WebView 网页的注入及客户端构建.</p>
</blockquote>
<h2>[m] get<span><a class="mark" href="#http_m_get" id="http_m_get">#</a></span></h2>
<h3>get(url, options?, callback?)<span><a class="mark" href="#http_get_url_options_callback" id="http_get_url_options_callback">#</a></span></h3>
<div class="signature"><ul>
<li><code>url</code> { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> } 请求的URL地址, 需要以&quot;http://&quot;或&quot;https://&quot;开头. 如果url没有以&quot;http://&quot;开头, 则默认为&quot;http://&quot;.</li>
<li><code>options</code> { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">Object</a> } 请求选项. 参见[http.request()][].</li>
@@ -201,7 +251,8 @@ if(res.statusCode != 200){
toast(util.format(&quot;温度: %s 湿度: %s 空气质量: %s&quot;, weather.data.wendu,
weather.data.shidu, weather.quality));
}
</code></pre><h2>http.post(url, data[, options, callback])<span><a class="mark" href="#http_http_post_url_data_options_callback" id="http_http_post_url_data_options_callback">#</a></span></h2>
</code></pre><h2>[m] post<span><a class="mark" href="#http_m_post" id="http_m_post">#</a></span></h2>
<h3>post(url, data, options?, callback?)<span><a class="mark" href="#http_post_url_data_options_callback" id="http_post_url_data_options_callback">#</a></span></h3>
<div class="signature"><ul>
<li><code>url</code> { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> } 请求的URL地址, 需要以&quot;http://&quot;或&quot;https://&quot;开头. 如果url没有以&quot;http://&quot;开头, 则默认为&quot;http://&quot;.</li>
<li><code>data</code> { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> } | { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">Object</a> } POST数据.</li>
@@ -224,7 +275,8 @@ if(html.contains(&quot;页面跳转中&quot;)){
}else{
toast(&quot;登录失败&quot;);
}
</code></pre><h2>http.postJson(url[, data, options, callback])<span><a class="mark" href="#http_http_postjson_url_data_options_callback" id="http_http_postjson_url_data_options_callback">#</a></span></h2>
</code></pre><h2>[m] postJson<span><a class="mark" href="#http_m_postjson" id="http_m_postjson">#</a></span></h2>
<h3>postJson(url, data?, options?, callback?)<span><a class="mark" href="#http_postjson_url_data_options_callback" id="http_postjson_url_data_options_callback">#</a></span></h3>
<div class="signature"><ul>
<li><code>url</code> { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> } 请求的URL地址, 需要以&quot;http://&quot;或&quot;https://&quot;开头. 如果url没有以&quot;http://&quot;开头, 则默认为&quot;http://&quot;.</li>
<li><code>data</code> { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">Object</a> } POST数据.</li>
@@ -241,7 +293,8 @@ r = http.postJson(url, {
userid: &quot;1&quot;,
});
toastLog(r.body.string());
</code></pre><h2>http.postMultipart(url, files[, options, callback])<span><a class="mark" href="#http_http_postmultipart_url_files_options_callback" id="http_http_postmultipart_url_files_options_callback">#</a></span></h2>
</code></pre><h2>[m] postMultipart<span><a class="mark" href="#http_m_postmultipart" id="http_m_postmultipart">#</a></span></h2>
<h3>postMultipart(url, files, options?, callback?)<span><a class="mark" href="#http_postmultipart_url_files_options_callback" id="http_postmultipart_url_files_options_callback">#</a></span></h3>
<div class="signature"><ul>
<li><code>url</code> { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> } 请求的URL地址, 需要以&quot;http://&quot;或&quot;https://&quot;开头. 如果url没有以&quot;http://&quot;开头, 则默认为&quot;http://&quot;.</li>
<li><code>files</code> { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">Object</a> } POST数据.</li>
@@ -276,7 +329,8 @@ log(res.body.string());
file: open(&quot;/sdcard/1.txt&quot;)
});
log(res.body.string());
</code></pre><h2>http.request(url[, options, callback])<span><a class="mark" href="#http_http_request_url_options_callback" id="http_http_request_url_options_callback">#</a></span></h2>
</code></pre><h2>[m] request<span><a class="mark" href="#http_m_request" id="http_m_request">#</a></span></h2>
<h3>request(url, options?, callback?)<span><a class="mark" href="#http_request_url_options_callback" id="http_request_url_options_callback">#</a></span></h3>
<div class="signature"><ul>
<li><code>url</code> { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> } 请求的URL地址, 需要以&quot;http://&quot;或&quot;https://&quot;开头. 如果url没有以&quot;http://&quot;开头, 则默认为&quot;http://&quot;.</li>
<li><code>options</code> { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">Object</a> } 请求选项. 参见[http.buildRequest()][].</li>
@@ -291,79 +345,27 @@ log(res.body.string());
<li><code>body</code> { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> } | { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array" class="type">Array</a> } | { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function" class="type">Function</a> } HTTP请求的内容. 可以是一个字符串, 也可以是一个字节数组;或者是一个以<a href="https://github.com/square/okio/blob/master/okio/src/main/java/okio/BufferedSink.java/">BufferedSink</a>为参数的函数.</li>
</ul>
<p>该函数是get, post, postJson等函数的基础函数. 因此除非是PUT, DELET等请求, 或者需要更高定制的HTTP请求, 否则直接使用get, post, postJson等函数会更加方便.</p>
<h1>Response<span><a class="mark" href="#http_response" id="http_response">#</a></span></h1>
<p>HTTP请求的响应.</p>
<h2>Response.statusCode<span><a class="mark" href="#http_response_statuscode" id="http_response_statuscode">#</a></span></h2>
<div class="signature"><ul>
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">number</a> }</li>
</ul>
</div><p>当前响应的HTTP状态码. 例如200(OK), 404(Not Found)等.</p>
<p>有关HTTP状态码的信息, 参见<a href="http://www.runoob.com/http/http-status-codes.html">菜鸟教程:HTTP状态码</a>.</p>
<h2>Response.statusMessage<span><a class="mark" href="#http_response_statusmessage" id="http_response_statusmessage">#</a></span></h2>
<div class="signature"><ul>
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> }</li>
</ul>
</div><p>当前响应的HTTP状态信息. 例如&quot;OK&quot;, &quot;Bad Request&quot;, &quot;Forbidden&quot;.</p>
<p>有关HTTP状态码的信息, 参见<a href="http://www.runoob.com/http/http-status-codes.html">菜鸟教程:HTTP状态码</a>.</p>
<p>例子:</p>
<pre><code>var res = http.get(&quot;www.baidu.com&quot;);
if(res.statusCode &gt;= 200 &amp;&amp; res.statusCode &lt; 300){
toast(&quot;页面获取成功!&quot;);
}else if(res.statusCode == 404){
toast(&quot;页面没找到哦...&quot;);
}else{
toast(&quot;错误: &quot; + res.statusCode + &quot; &quot; + res.statusMessage);
}
</code></pre><h2>Response.headers<span><a class="mark" href="#http_response_headers" id="http_response_headers">#</a></span></h2>
<div class="signature"><ul>
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">Object</a> }</li>
</ul>
</div><p>当前响应的HTTP头部信息. 该对象的键是响应头名称, 值是各自的响应头值. 所有响应头名称都是小写的(吗).</p>
<p>有关HTTP头部信息, 参见<a href="http://www.runoob.com/http/http-header-fields.html">菜鸟教程:HTTP响应头信息</a>.</p>
<p>例子:</p>
<pre><code>console.show();
var res = http.get(&quot;www.qq.com&quot;);
console.log(&quot;HTTP Headers:&quot;)
for(var headerName in res.headers){
console.log(&quot;%s: %s&quot;, headerName, res.headers[headerName]);
}
</code></pre><h2>Response.body<span><a class="mark" href="#http_response_body" id="http_response_body">#</a></span></h2>
<div class="signature"><ul>
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">Object</a> }</li>
</ul>
</div><p>当前响应的内容. 他有以下属性和函数:</p>
<ul>
<li>bytes() { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array" class="type">Array</a> } 以字节数组形式返回响应内容</li>
<li>string() { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> } 以字符串形式返回响应内容</li>
<li>json() { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">Object</a> } 把响应内容作为JSON格式的数据并调用JSON.parse, 返回解析后的对象</li>
<li>contentType { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> } 当前响应的内容类型</li>
</ul>
<h2>Response.request<span><a class="mark" href="#http_response_request" id="http_response_request">#</a></span></h2>
<div class="signature"><ul>
<li>{ <span class="type">Request</span> }
当前响应所对应的请求. 参见[Request][].</li>
</ul>
</div><h2>Response.url<span><a class="mark" href="#http_response_url" id="http_response_url">#</a></span></h2>
<div class="signature"><ul>
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">number</a> }
当前响应所对应的请求URL.</li>
</ul>
</div><h2>Response.method<span><a class="mark" href="#http_response_method" id="http_response_method">#</a></span></h2>
<div class="signature"><ul>
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> }
当前响应所对应的HTTP请求的方法. 例如&quot;GET&quot;, &quot;POST&quot;, &quot;PUT&quot;等.</li>
</ul>
</div>
<h2>[m] buildRequest<span><a class="mark" href="#http_m_buildrequest" id="http_m_buildrequest">#</a></span></h2>
<h3>buildRequest(url, options)<span><a class="mark" href="#http_buildrequest_url_options" id="http_buildrequest_url_options">#</a></span></h3>
<p>... ...</p>
</div>
</div>
</div>
<script src="assets/sh_javascript.js"></script>
<script src="assets/sh_java.js"></script>
<script src="assets/sh_main.js"></script>
<script src="plugins/docsify-copy-code@2.js"></script>
<script src="plugins/zoom-image.js"></script>
<script>
highlight(void 0, void 0, 'pre');
highlight(void 0, void 0, 'tt');
</script>
<!-- __TRACKING__ -->
</body>
</html>