mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-27 19:01:01 +00:00
[frontend] add Accept header to oauthed api requests (#657)
This commit is contained in:
parent
610395d5a5
commit
ec81d28a77
1 changed files with 3 additions and 2 deletions
|
@ -149,7 +149,7 @@ module.exports = function oauthClient(config, initState) {
|
|||
return (state.access_token != undefined);
|
||||
}
|
||||
|
||||
function apiRequest(path, method, data, type="json") {
|
||||
function apiRequest(path, method, data, type="json", accept="json") {
|
||||
if (!isAuthorized()) {
|
||||
throw new Error("Not Authenticated");
|
||||
}
|
||||
|
@ -160,7 +160,8 @@ module.exports = function oauthClient(config, initState) {
|
|||
url.search = s;
|
||||
}
|
||||
let headers = {
|
||||
"Authorization": `Bearer ${state.access_token}`
|
||||
"Authorization": `Bearer ${state.access_token}`,
|
||||
"Accept": accept == "json" ? "application/json" : "*/*"
|
||||
};
|
||||
let body = data;
|
||||
if (type == "json" && body != undefined) {
|
||||
|
|
Loading…
Reference in a new issue