<i id='FNyDz'><tr id='FNyDz'><dt id='FNyDz'><q id='FNyDz'><span id='FNyDz'><b id='FNyDz'><form id='FNyDz'><ins id='FNyDz'></ins><ul id='FNyDz'></ul><sub id='FNyDz'></sub></form><legend id='FNyDz'></legend><bdo id='FNyDz'><pre id='FNyDz'><center id='FNyDz'></center></pre></bdo></b><th id='FNyDz'></th></span></q></dt></tr></i><div id='FNyDz'><tfoot id='FNyDz'></tfoot><dl id='FNyDz'><fieldset id='FNyDz'></fieldset></dl></div>
  • <small id='FNyDz'></small><noframes id='FNyDz'>

    <legend id='FNyDz'><style id='FNyDz'><dir id='FNyDz'><q id='FNyDz'></q></dir></style></legend>
    • <bdo id='FNyDz'></bdo><ul id='FNyDz'></ul>

      1. <tfoot id='FNyDz'></tfoot>
      2. HTTP 参数和 HTTP 标头有什么区别?

        时间:2023-07-08
          <bdo id='nwMCe'></bdo><ul id='nwMCe'></ul>
          <tfoot id='nwMCe'></tfoot>

          1. <i id='nwMCe'><tr id='nwMCe'><dt id='nwMCe'><q id='nwMCe'><span id='nwMCe'><b id='nwMCe'><form id='nwMCe'><ins id='nwMCe'></ins><ul id='nwMCe'></ul><sub id='nwMCe'></sub></form><legend id='nwMCe'></legend><bdo id='nwMCe'><pre id='nwMCe'><center id='nwMCe'></center></pre></bdo></b><th id='nwMCe'></th></span></q></dt></tr></i><div id='nwMCe'><tfoot id='nwMCe'></tfoot><dl id='nwMCe'><fieldset id='nwMCe'></fieldset></dl></div>

              1. <small id='nwMCe'></small><noframes id='nwMCe'>

                  <tbody id='nwMCe'></tbody>
                <legend id='nwMCe'><style id='nwMCe'><dir id='nwMCe'><q id='nwMCe'></q></dir></style></legend>

                • 本文介绍了HTTP 参数和 HTTP 标头有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我阅读了 this 问题,但它没有回答我的问题.

                  I read this question but it didn't answer my question.

                  对我来说,标题和参数都是字典,不同之处在于标题是 [String : String] 而参数是 [String : AnyObject]? 等等,如果你的参数也是字符串,那么您可以在标题中发送它们(同时使用x-"前缀表示它们不是标准标题),这是一种常见但不是好的做法.

                  To me Headers and Parameters are both dictionaries with the difference that headers is [String : String] while Parameters is [String : AnyObject]? and so if your parameters are also Strings then you could send them within the headers (while using a 'x-' prefix to signify they aren't standard headers) which is a common but not good practice.

                  • 正确吗?
                  • headersparameters 还有其他区别吗?
                  • 您会使用 parameters 发送哪些其他非字符串类型?
                  • Is that correct?
                  • Are there other difference between headers and parameters?
                  • What kind of other non-String types would you be sending using parameters?

                  Alamofire 请求方法

                  Alamofire Request method

                  public func request(
                          method: Method,
                          _ URLString: URLStringConvertible,
                            parameters: [String: AnyObject]? = nil,
                            encoding: ParameterEncoding = .URL,
                            headers: [String: String]? = nil)
                          -> Request
                      {
                          return Manager.sharedInstance.request(
                              method,
                              URLString,
                              parameters: parameters,
                              encoding: encoding,
                              headers: headers
                          )
                      }
                  

                  作为一个例子,我看到人们通过 ["x-ios-version" : UIDevice.currentDevice().systemVersion] 或通过标题构建版本

                  As an example I have seen people passing ["x-ios-version" : UIDevice.currentDevice().systemVersion] or build versions through headers

                  推荐答案

                  以下是差异列表:

                  1. 它们是为不同的目的而设计的.标头携带元信息,参数携带实际数据.

                  1. They are designed for different purposes. Headers carry meta info, parameters carry actual data.

                  HTTP 服务器将自动取消转义/解码参数名称/值.这不适用于标头名称/值.

                  HTTP Server will automatically un-escape/decode parameter names/values. This does not apply to header names/values.

                  标题名称/值需要在客户端手动转义/编码,并在服务器端手动取消转义/解码.经常使用 Base64 编码或百分比转义.

                  Header names/values need to be manually escaped/encoded at client side and be manually un-escaped/decoded at server side. Base64 encoding or percent escape is often used.

                  最终用户可以看到参数(在 URL 中),但标题对最终用户是隐藏的.

                  Parameters can be seen by end-users (in URL), but headers are hidden to end-users.

                  这篇关于HTTP 参数和 HTTP 标头有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:UIImage 从服务器逐步显示 下一篇:带有自定义标头的 Android WebView 发布请求

                  相关文章

                  <legend id='Riyjf'><style id='Riyjf'><dir id='Riyjf'><q id='Riyjf'></q></dir></style></legend>

                  <i id='Riyjf'><tr id='Riyjf'><dt id='Riyjf'><q id='Riyjf'><span id='Riyjf'><b id='Riyjf'><form id='Riyjf'><ins id='Riyjf'></ins><ul id='Riyjf'></ul><sub id='Riyjf'></sub></form><legend id='Riyjf'></legend><bdo id='Riyjf'><pre id='Riyjf'><center id='Riyjf'></center></pre></bdo></b><th id='Riyjf'></th></span></q></dt></tr></i><div id='Riyjf'><tfoot id='Riyjf'></tfoot><dl id='Riyjf'><fieldset id='Riyjf'></fieldset></dl></div>

                    <small id='Riyjf'></small><noframes id='Riyjf'>

                      <tfoot id='Riyjf'></tfoot>

                      • <bdo id='Riyjf'></bdo><ul id='Riyjf'></ul>