Decapitate "network" plugin

Reviewed By: lawrencelomax

Differential Revision: D39466980

fbshipit-source-id: b880690a2b334fd063f2d06923743d67b79e7b08
This commit is contained in:
Andrey Goncharov
2022-09-15 10:02:19 -07:00
committed by Facebook GitHub Bot
parent cb610ec751
commit f463520522
3 changed files with 20 additions and 10 deletions

View File

@@ -170,6 +170,15 @@ export function bodyAsBinary(
return undefined;
}
export const queryToObj = (query: string) => {
const params = new URLSearchParams(query);
const obj: Record<string, any> = {};
params.forEach((value, key) => {
obj[key] = value;
});
return obj;
};
function escapeCharacter(x: string) {
const code = x.charCodeAt(0);
return code < 16 ? '\\u0' + code.toString(16) : '\\u' + code.toString(16);