Skip to content
Snippets Groups Projects
Unverified Commit a73a7877 authored by MeiMei's avatar MeiMei Committed by GitHub
Browse files

Fix prelude/url (#7855)

parent bd9df789
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,7 @@ export function query(obj: {}): string {
.reduce((a, [k, v]) => (a[k] = v, a), {} as Record<string, any>);
return Object.entries(params)
.map((e) => `${e[0]}=${e[1]}`)
.map((e) => `${e[0]}=${encodeURIComponent(e[1])}`)
.join('&');
}
......
import * as assert from 'assert';
import { query } from '../../src/prelude/url';
describe('url', () => {
it('query', () => {
const s = query({
foo: 'ふぅ',
bar: 'b a r',
baz: undefined
});
assert.deepStrictEqual(s, 'foo=%E3%81%B5%E3%81%85&bar=b%20a%20r');
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment