Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/221.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么在android中webview头键转换为小写?_Android_Webview_Http Headers - Fatal编程技术网

为什么在android中webview头键转换为小写?

为什么在android中webview头键转换为小写?,android,webview,http-headers,Android,Webview,Http Headers,我在android的webview中发送自定义标题。当我在服务器中打印标题参数键和值时,参数值按原样打印(发送时),但参数键按小写打印,但我的要求是按原样打印参数键(发送时)。我们如何才能做到这一点 下面是我的java代码 webView.getSettings().setDomStorageEnabled(true); webView.getSettings().setDefaultTextEncodingName("utf-8"); webView.getSettings()

我在android的webview中发送自定义标题。当我在服务器中打印标题参数键和值时,参数值按原样打印(发送时),但参数键按小写打印,但我的要求是按原样打印参数键(发送时)。我们如何才能做到这一点

下面是我的java代码

webView.getSettings().setDomStorageEnabled(true);
    webView.getSettings().setDefaultTextEncodingName("utf-8");
    webView.getSettings().setJavaScriptEnabled(true);

headerValue = new HashMap<>();
   String headerKey = "A-Abc-Def-API-Version";
   headerValue.put(headerKey, "Abc");
   webView.loadUrl(webViewUrl, headerValue);

HTTP头名称不区分大小写。如果您的实现需要区分大小写,则会违反标准

3.2。标题字段

每个标头字段由一个不区分大小写的字段名组成 后跟冒号(“:”),可选的前导空格,字段 值,以及可选的尾随空格


来源:

感谢您的回复,但我感到困惑的是,当我们在IOS设备上打印它时,它是按原样打印的,因为我们正在发送参数键,如“A-Abc-Def-API-Version:Abc”。IOS是否违反了标准?
<?php
    echo "test";

$headers =  getallheaders();
foreach($headers as $key=>$val){
  echo $key . ': ' . $val . '<br>';
}

?>
Accept:
a-abc-def-api-version: Abc