Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Feb 16, 2023
1 parent 31bc600 commit 09ea077
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/encoding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ const ENC_ENC_SLASH_RE = /%252f/gi;
* @returns encoded string
*/
export function encode(text: string | number): string {
return encodeURI("" + text)
.replace(ENC_PIPE_RE, "|");
return encodeURI("" + text).replace(ENC_PIPE_RE, "|");
}

/**
Expand Down
6 changes: 5 additions & 1 deletion test/query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ describe("withQuery", () => {
},
{ input: "/?x=1,2,3", query: { y: "1,2,3" }, out: "/?x=1,2,3&y=1,2,3" },
{ input: "http://a.com?v=1", query: { x: 2 }, out: "http://a.com?v=1&x=2" },
{ input: "/", query: { json: "{\"test\":[\"content\"]}" }, out: "/?json=%7B%22test%22:%5B%22content%22%5D%7D" },
{
input: "/",
query: { json: '{"test":["content"]}' },
out: "/?json=%7B%22test%22:%5B%22content%22%5D%7D",
},
{ input: "/", query: { param: ["3", ""] }, out: "/?param=3&param=" },
{ input: "/", query: { param: ["", "3"] }, out: "/?param=&param=3" },
];
Expand Down

0 comments on commit 09ea077

Please sign in to comment.