diff options
| author | 2022-06-20 10:44:01 +0200 | |
|---|---|---|
| committer | 2022-06-20 10:44:01 +0200 | |
| commit | ec81d28a7767f8dc7863114e9436098af751cd0e (patch) | |
| tree | cb63583f55a20d3999fb47f77a8b28a4030fc931 /web/source/lib | |
| parent | [chore] make tests more cacheable by avoiding time.Now() (#656) (diff) | |
| download | gotosocial-ec81d28a7767f8dc7863114e9436098af751cd0e.tar.xz | |
[frontend] add Accept header to oauthed api requests (#657)
Diffstat (limited to 'web/source/lib')
| -rw-r--r-- | web/source/lib/oauth.js | 5 | 
1 files changed, 3 insertions, 2 deletions
| diff --git a/web/source/lib/oauth.js b/web/source/lib/oauth.js index 673d4ce83..9cbf3d484 100644 --- a/web/source/lib/oauth.js +++ b/web/source/lib/oauth.js @@ -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) { | 
