mirror of
https://github.com/Radiquum/AniX.git
synced 2025-09-08 23:43:55 +05:00
feat/api-prox: add POST proxy
This commit is contained in:
parent
deb92f1480
commit
a24371cf24
6 changed files with 95 additions and 57 deletions
|
@ -1,13 +1,15 @@
|
|||
function match(url: URL): boolean {
|
||||
return url.pathname == "/profile/1";
|
||||
const priority = 0;
|
||||
|
||||
function match(url: URL, method: "GET" | "POST"): boolean {
|
||||
return url.pathname == "/profile/1" && method == "GET";
|
||||
}
|
||||
|
||||
function hook(data: any, _: URL) {
|
||||
function hook(data: any, _: URL, __: "GET" | "POST") {
|
||||
const newUname = "Anixartiki";
|
||||
if (!data.hasOwnProperty("profile") || !data.profile) return data;
|
||||
data["profile"]["login"] = newUname;
|
||||
return data;
|
||||
}
|
||||
|
||||
const entrypoint = { priority: 1, match, hook }
|
||||
export default entrypoint;
|
||||
const entrypoint = { priority, match, hook };
|
||||
export default entrypoint;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue