[refactor] proxy url by header

This commit is contained in:
kwaroran
2023-07-07 06:30:04 +09:00
parent ead670516d
commit e338940708
3 changed files with 9 additions and 4 deletions

View File

@@ -617,12 +617,13 @@ export async function globalFetch(url:string, arg:{plainFetchForce?:boolean,body
}
}
if(arg.rawResponse){
const furl = `/proxy2?url=${encodeURIComponent(url)}`
const furl = `/proxy2`
const da = await fetch(furl, {
body: body,
headers: {
"risu-header": encodeURIComponent(JSON.stringify(arg.headers)),
"risu-url": encodeURIComponent(url),
"Content-Type": "application/json"
},
method: method,
@@ -637,12 +638,13 @@ export async function globalFetch(url:string, arg:{plainFetchForce?:boolean,body
}
}
else{
const furl = `/proxy2?url=${encodeURIComponent(url)}`
const furl = `/proxy2`
const da = await fetch(furl, {
body: body,
headers: {
"risu-header": encodeURIComponent(JSON.stringify(arg.headers)),
"risu-url": encodeURIComponent(url),
"Content-Type": "application/json"
},
method: method