mswjs / headers-polyfill Goto Github PK
View Code? Open in Web Editor NEWA Fetch API "Headers" polyfill and transformation library.
Home Page: https://npm.im/headers-polyfill
License: MIT License
A Fetch API "Headers" polyfill and transformation library.
Home Page: https://npm.im/headers-polyfill
License: MIT License
Hello, I'm getting this error with @cypress/webpack-preprocessor
due to this change
10.4.0
Error: Webpack Compilation Error
../node_modules/msw/node_modules/headers-polyfill/lib/index.js 105:64
Module parse failed: Unexpected token (105:64)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| }
| get(name) {
> return this[NORMALIZED_HEADERS][normalizeHeaderName(name)] ?? null;
| }
| set(name, value) {
@ ../node_modules/msw/lib/node/index.mjs 269:0-51 276:22-37 411:0-43 414:22-29 488:0-71 491:0-51 494:18-33 570:26-42 642:0-55 696:19-27 720:0-55 723:0-55 755:19-27
@ ../node_modules/@s-ui/mock/lib/server.js
@ ../node_modules/@s-ui/mock/lib/index.js
@ ../mocks/index.js
@ ./support/index.js
at handle (/home/travis/.cache/Cypress/10.4.0/Cypress/resources/app/node_modules/@packages/server/node_modules/@cypress/webpack-preprocessor/dist/index.js:180:23)
at finalCallback (/home/travis/.cache/Cypress/10.4.0/Cypress/resources/app/node_modules/webpack/lib/Compiler.js:257:39)
at /home/travis/.cache/Cypress/10.4.0/Cypress/resources/app/node_modules/webpack/lib/Compiler.js:306:14
at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/travis/.cache/Cypress/10.4.0/Cypress/resources/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (/home/travis/.cache/Cypress/10.4.0/Cypress/resources/app/node_modules/tapable/lib/Hook.js:154:20)
at /home/travis/.cache/Cypress/10.4.0/Cypress/resources/app/node_modules/webpack/lib/Compiler.js:304:22
at Compiler.emitRecords (/home/travis/.cache/Cypress/10.4.0/Cypress/resources/app/node_modules/webpack/lib/Compiler.js:499:39)
at /home/travis/.cache/Cypress/10.4.0/Cypress/resources/app/node_modules/webpack/lib/Compiler.js:298:10
at /home/travis/.cache/Cypress/10.4.0/Cypress/resources/app/node_modules/webpack/lib/Compiler.js:485:14
at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/travis/.cache/Cypress/10.4.0/Cypress/resources/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (/home/travis/.cache/Cypress/10.4.0/Cypress/resources/app/node_modules/tapable/lib/Hook.js:154:20)
at /home/travis/.cache/Cypress/10.4.0/Cypress/resources/app/node_modules/webpack/lib/Compiler.js:482:27
at /home/travis/.cache/Cypress/10.4.0/Cypress/resources/app/node_modules/neo-async/async.js:2818:7
at done (/home/travis/.cache/Cypress/10.4.0/Cypress/resources/app/node_modules/neo-async/async.js:3522:9)
at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/travis/.cache/Cypress/10.4.0/Cypress/resources/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (/home/travis/.cache/Cypress/10.4.0/Cypress/resources/app/node_modules/tapable/lib/Hook.js:154:20)
at /home/travis/.cache/Cypress/10.4.0/Cypress/resources/app/node_modules/webpack/lib/Compiler.js:464:33
at /home/travis/.cache/Cypress/10.4.0/Cypress/resources/app/node_modules/@packages/server/node_modules/graceful-fs/graceful-fs.js:143:16
at /home/travis/.cache/Cypress/10.4.0/Cypress/resources/app/node_modules/@packages/server/node_modules/graceful-fs/graceful-fs.js:143:16
at /home/travis/.cache/Cypress/10.4.0/Cypress/resources/app/node_modules/@packages/server/node_modules/graceful-fs/graceful-fs.js:61:14
at FSReqCallback.oncomplete (node:fs:192:23)
Given called headersToObject
with the following header:
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.0 Safari/537.36
It splits this header by encountered ,
(comma), resulting into two headers:
I suppose certain headers can have commas, and can never have multiple values. I think this library should respect that.
I don't see any license declared for this, and no license file. The only reference I see is in the package.json, but this doesn't satisfy the license requirements. Can one be decided on and added to the repository?
Recent commit "feat: implements "getSetCookie" method on Headers" (cff8faf)
changed line 74 of src/headers.ts (https://github.com/mswjs/headers-polyfill/blob/main/src/Headers.ts#L73)
from:
get(name: string): string | null {
return this[NORMALIZED_HEADERS][normalizeHeaderName(name)] || null
}
to
get(name: string): string | null {
return this[NORMALIZED_HEADERS][normalizeHeaderName(name)] ?? null
}
(now using the Nullish coalescing operator (??))
This is now causing webpack to throw a build error.
ERROR Failed to compile with 1 error9:19:13 pm
error in ./node_modules/headers-polyfill/lib/index.mjs
Module parse failed: Unexpected token (71:64)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| }
| get(name) {
> return this[NORMALIZED_HEADERS][normalizeHeaderName(name)] ?? null;
| }
| set(name, value) {
@ ./node_modules/msw/lib/index.js 147:30-57 304:31-58 542:31-58 549:31-58 574:31-58 927:31-58 1002:31-58 1005:31-58 1610:31-58
@ ./src/mocks/browser.js
@ ./src/main.js
@ multi ./src/main.js
ERROR Build failed with errors.
I've created a repo to make it easy to reproduce the issue.
I've also created a shell script (show-error.sh
) to quickly show the error and what happens when you revert the change from to the ??
operator.
To improve specification-compliance, we must not set any custom methods on the Headers
instance. This includes:
all()
raw()
Instead, remove those methods and implement them as transformers:
import { Headers, getAllHeaders, getRawHeaders } from 'headers-polyfill'
const headers = new Headers({})
getAllHeaders(headers)
getRawHeaders(headers)
When appending a header via headers.set(name, value)
the value
sometimes contains an empty trailing space:
{
"x-powered-by": "msw ",
"content-type": "application/json ",
"x-header": "yes"
}
See the values of the
x-powered-by
andcontent-type
headers.
Header values do not contain extra leading/trailing spaces.
const h = new Headers({ accept: '*/*' })
const h2 = new Headers(h)
{
_headers: { _headers: '[object Object], _names: '[object Object]' },
_names: Map { accept => 'accept' }
}
{
_headers: { accept: '*/*' },
_names: Map { accept => 'accept' }
}
The standard Headers
instance can be used as the init to another Headers
instance.
I'm using [email protected]
The fresh installation installs [email protected]
through @mswjs/interceptors
.
I stopped to work for graphql. We receive now this error when calling mocked graqpql endpoint
Received: [[GraphQLError: request to http://localhost:9990/api/test failed, reason: response3.headers.all is not a function]]
Using [email protected]
resolution works without problem
"resolutions": {
"headers-polyfill": "3.2.5"
}
I'm using vite
with mswjs
. After I bump versions of non-major dependencies, the following error is thrown caused by headers-polyfill
. Currently, downgrading to v3.0.10 can fix it.
vite v3.1.1 building for production...
transforming...
✓ 25 modules transformed.
[commonjs--resolver] Missing "./lib" export in "headers-polyfill" package
file: /home/runner/work/vitify-admin/vitify-admin/node_modules/.pnpm/[email protected][email protected]/node_modules/msw/lib/index.js
error during build:
Error: Missing "./lib" export in "headers-polyfill" package
at bail (file:///home/runner/work/vitify-admin/vitify-admin/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-a713b95d.js:33701:8)
at resolve (file:///home/runner/work/vitify-admin/vitify-admin/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-a713b95d.js:33778:10)
at resolveExports (file:///home/runner/work/vitify-admin/vitify-admin/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-a713b95d.js:34835:12)
at resolveDeepImport (file:///home/runner/work/vitify-admin/vitify-admin/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-a713b95d.js:34853:31)
at tryNodeResolve (file:///home/runner/work/vitify-admin/vitify-admin/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-a713b95d.js:3[45](https://github.com/kingyue737/vitify-admin/actions/runs/3059919545/jobs/4937844820#step:8:46)70:20)
at Object.resolveId (file:///home/runner/work/vitify-admin/vitify-admin/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-a713b95d.js:34343:28)
at file:///home/runner/work/vitify-admin/vitify-admin/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:22710:40
ELIFECYCLE Command failed with exit code 1.
Error: The process '/home/runner/setup-pnpm/node_modules/.bin/pnpm' failed with exit code 1
I just ran npm update
, which updated headers-polyfill
to the just released 3.1.0
, which modifies the exports in package.json
. This is the error I get:
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib' is not defined by "exports" in /myapp/node_modules/headers-polyfill/package.json
at new NodeError (node:internal/errors:387:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:464:9)
at packageExportsResolve (node:internal/modules/esm/resolve:748:3)
at resolveExports (node:internal/modules/cjs/loader:493:36)
at Function.Module._findPath (node:internal/modules/cjs/loader:533:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:942:27)
at Function.Module._load (node:internal/modules/cjs/loader:804:27)
at Module.require (node:internal/modules/cjs/loader:1028:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/myapp/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/NodeClientRequest.js:89:13) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
According to MDN, setting multiple cookies in an HTTP response should be done by using multiple "Set-Cookie" headers.
To send multiple cookies, multiple Set-Cookie headers should be sent in the same response.
As far as I know, this is not possible with the headers-polyfill.
> const h = new Headers();
> h.set('set-cookie', 'foo=bar');
> h.set('set-cookie', 'bar=baz');
> h.raw()
-> { 'set-cookie': 'bar=baz' }
There should be a way for setting multiple set-cookie
entries. Comma-separated value (set-cookie: foo=bar, bar=baz
) is deprecated and not implemented by modern browsers.
First, sorry, I'm not familiar with the details of the HTTP protocol.
But I'm now having trouble with this cookie header-related problem.
After some of the investigation, the cookie header seems to be separated by ;
not ,
.
Related.
microsoft/reverse-proxy#437
https://datatracker.ietf.org/doc/html/rfc6265#section-4.2.1
Here is a reproduction that sets two cookies and outputs them, once via getSetCookie, once via forEach:
import {Headers} from "headers-polyfill";
// import {Headers} from "undici";
const h = new Headers();
h.append(
"set-cookie",
"a=a; Expires=Wed, 21 Oct 2015 07:28:00 GMT",
);
h.append(
"Set-Cookie",
"b=b; Expires=Wed, 21 Oct 2015 07:28:00 GMT",
);
const cookies = [];
h.forEach((value, key) => {
cookies.push(value);
});
console.log("cookies via forEach:", cookies);
console.log("cookeis via getSetCookie", h.getSetCookie())
$ node r.mjs
cookies via forEach: [
'a=a; Expires=Wed, 21 Oct 2015 07:28:00 GMT, b=b; Expires=Wed, 21 Oct 2015 07:28:00 GMT'
]
cookeis via getSetCookie [
'a=a; Expires=Wed',
'21 Oct 2015 07:28:00 GMT',
'b=b; Expires=Wed',
'21 Oct 2015 07:28:00 GMT'
]
I would expect forEach and getSetCookie to produce the same result, an array with two entries, one for each cookie.
With undici, we get the expected result:
$ node r.mjs
cookies via forEach: [
'a=a; Expires=Wed, 21 Oct 2015 07:28:00 GMT',
'b=b; Expires=Wed, 21 Oct 2015 07:28:00 GMT'
]
cookeis via getSetCookie [
'a=a; Expires=Wed, 21 Oct 2015 07:28:00 GMT',
'b=b; Expires=Wed, 21 Oct 2015 07:28:00 GMT'
]
Useful when dealing with XMLHttpRequest.getAllResponseHeaders
.
Input:
date: Fri, 08 Dec 2017 21:04:30 GMT\r\n
content-encoding: gzip\r\n
x-content-type-options: nosniff\r\n
server: meinheld/0.6.1\r\n
x-frame-options: DENY\r\n
content-type: text/html; charset=utf-8\r\n
connection: keep-alive\r\n
strict-transport-security: max-age=63072000\r\n
vary: Cookie, Accept-Encoding\r\n
content-length: 6502\r\n
x-xss-protection: 1; mode=block\r\n
Output: Record<string, string | string[]>
I'm getting this error in a project with MSW since yesterday
Failed to compile.
./node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/NodeClientRequest.js
Module not found: Package path ./lib is not exported from package /node_modules/headers-polyfill (see exports field in /node_modules/headers-polyfill/package.json)
The issue is there's no lib folder and /esm/package.json couldn't get such dependencies
MSW is installed in my project since April working flawless, but since your last update (yesterday) stopped working
const input = {
accept: '*/*',
Accept: '*/*'
}
const headers = new Headers(input)
expect(headers.get('accept')).toEqual('*/*')
// Currently ["*/*", "*/*"]
The http.OutgoingHeaders
may contain multiple same headers with different casing.
Node.js's update to Undici 5.26.3 caused its Headers
class to be called _Headers
:
As a result, passing a native Undici Headers object to headers-polyfill (which happens when MSW intercepts a native Node.js fetch
request with headers) loses the headers' contents.
To reproduce, run the following script in Node.js 18.16.1 (where it outputs the expected headers) and Node 18.18.2 (where it does not).
const hp = require('headers-polyfill');
console.log(hp.headersToString(new hp.Headers(new Headers({'Content-Type': 'application/json'}))));
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch [email protected]
for the project I'm working on.
Here is the diff that solved my problem:
diff --git a/node_modules/headers-polyfill/package.json b/node_modules/headers-polyfill/package.json
index 83849d7..4eb24a3 100644
--- a/node_modules/headers-polyfill/package.json
+++ b/node_modules/headers-polyfill/package.json
@@ -10,7 +10,8 @@
"types": "./lib/index.d.ts",
"require": "./lib/index.js",
"default": "./lib/index.mjs"
- }
+ },
+ "./lib": "./lib/index.js"
},
"repository": "https://github.com/mswjs/headers-polyfill",
"author": "Artem Zakharchenko",
This issue body was partially generated by patch-package.
I'm getting the following error with a package that uses headers-polyfill
version 3.1.2
Error: Package subpath './lib' is not defined by "exports" in /Users/marklyck/colony/colony-frontend/node_modules/.pnpm/@[email protected]/node_modules/headers-polyfill/package.json
❯ Object.<anonymous> node_modules/.pnpm/@[email protected]/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/NodeClientRequest.js:100:13
❯ Object.<anonymous> node_modules/.pnpm/@[email protected]/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/http.get.js:25:27
❯ Object.<anonymous> node_modules/.pnpm/@[email protected]/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/index.js:54:18
❯ Object.<anonymous> node_modules/.pnpm/[email protected][email protected]/node_modules/msw/lib/node/index.js:63:28
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: {
"code": "ERR_PACKAGE_PATH_NOT_EXPORTED",
}
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
Is this an issue with msw
using the package wrong? Or is it a problem with this package?
I have not updated msw
but it looks like this was working in headers-polyfill
version 3.0.10
Hello,
I believe that after update to v3.1.0 there're some troubles with compiling. Failed to compile output looks like this:
../node_modules/msw/lib/index.js
Module not found: Package path ./lib is not exported from package /app/node_modules/headers-polyfill (see exports field in /app/node_modules/headers-polyfill/package.json)
Import trace for requested module:
./src/mocks/browser.js
./src/mocks/index.js
./src/pages/executions-tmv1/index.page.tsx
> Build failed because of webpack errors
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Uploading artifacts for failed job
Didn't have much time to deep dive, but maybe you're aware?
$ yarn add headers-polyfill
index.mjs
:import { Headers } from 'headers-polyfill';
index.mjs
:$ node index.mjs
Get the following error:
file:///Users/chentsulin/oss/test-headers-polyfill/index.mjs:1
import { Headers } from 'headers-polyfill'
^^^^^^^
SyntaxError: Named export 'Headers' not found. The requested module 'headers-polyfill' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'headers-polyfill';
const { Headers } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:128:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:194:5)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:385:24)
at async loadESM (node:internal/process/esm_loader:88:5)
at async handleMainPromise (node:internal/modules/run_main:61:12)
With the newest version 3.1.0, we are facing an error within our integration pipeline.
We are using msw
for testing, which has header-polyfills
as dependency.
With header-polyfills
version 3.0.10 everything was fine, with 3.1.0 we are getting this error:
Error: Package subpath './lib' is not defined by "exports" in /foo/node_modules/headers-polyfill/package.json
Our setup uses TypeScript and a Lerna Monorepo with Node 16.x
Hi There, Facing the below issue , while building the application. (npm run build)
Can't import the named export 'splitCookiesString' from non EcmaScript module (only default export is available)
Can you please check once
import {splitCookiesString} from "set-cookie-parser";
Following the recent 3.0.9, I'm having this issue when trying to start storybook (that does have msw/msw-storybook-addon :
ERROR in /project/node_modules/headers-polyfill/lib/Headers.js 9:25
Module parse failed: Unexpected token (9:25)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| class HeadersPolyfill {
| // Normalized header {"name":"a, b"} storage.
> [NORMALIZED_HEADERS] = {};
| // Keeps the mapping between the raw header name
| // and the normalized header name to ease the lookup.
Found someone else on S/O with the same issue as well.
Reverting to 3.0.4 via yarn resolutions worked for me.
FWIW I'm using babel-loader 8.1.0 in case that makes a difference, as the loader was mentioned.
Also, I'm seeing that Headers.js for 3.0.4 looks like minified js, whereas this looks much more like plain (pre-transpiler) javascript.
I do see the change in #33 that switches targets from ES5 to esnext... would that have this effect?
Please let me know if you need any other information about my project.
node v16.16
I just installed the headers-polyfill
package (v3.1.0
) and I'm getting the following error when I run the project (it's a CRA project):
ERROR in ./node_modules/msw/lib/index.js 564:17-48
Module not found: Error: Package path ./lib is not exported from package C:<path to app>\test-app\node_modules\headers-polyfill (see exports field in C:<path to app>\test-app\node_modules\headers-polyfill\package.json)
It seems the following code was added in package.json
in the 3.1.0
release and this seems to be the root cause:
"exports": {
".": {
"types": "./lib/index.d.ts",
"require": "./lib/index.js",
"default": "./lib/esm/index.js"
}
},
private
is really just a TypeScript sugar. Our internal properties right now are enumerable, leaking their presence and values to the end consumer:
headers-polyfill/src/Headers.ts
Line 7 in 75e658c
headers-polyfill/src/Headers.ts
Line 11 in 75e658c
Keep headers
and names
under symbols. Symbols are not enumerable by default, and can be accessed only by direct symbol reference. This is a great way of keeping internal properties.
const h = new Headers()
h.append('x', '1')
h.append('x', '2')
flattenHeadersObject(headersToObject(h))
// {"x":"1;2"}
Multiple values of the same header are joined by a comma, not a semicolon.
Headers
returns multi-value headers.flattenHeadersObject(headersToObject(h))
// {"x":"1,2"}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.