* Imitating https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/getAllResponseHeaders * Per the specification https://tools.ietf.org/html/rfc7230 the header name is within ASCII, * but we'll try encoding it, if necessary, to handle invalid server responses.
({ name, value, binaryValue })
| 145 | * but we'll try encoding it, if necessary, to handle invalid server responses. |
| 146 | */ |
| 147 | function encodeWebRequestHeader({ name, value, binaryValue }) { |
| 148 | return `${string2byteString(name)}: ${ |
| 149 | binaryValue |
| 150 | ? buffer2string(binaryValue) |
| 151 | : string2byteString(value) |
| 152 | }\r\n`; |
| 153 | } |
| 154 | |
| 155 | /** |
| 156 | * @param {string} headerValue |
nothing calls this directly
no test coverage detected