mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 17:52:25 -05: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); | 		return (state.access_token != undefined); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	function apiRequest(path, method, data, type="json") { | 	function apiRequest(path, method, data, type="json", accept="json") { | ||||||
| 		if (!isAuthorized()) { | 		if (!isAuthorized()) { | ||||||
| 			throw new Error("Not Authenticated"); | 			throw new Error("Not Authenticated"); | ||||||
| 		} | 		} | ||||||
|  | @ -160,7 +160,8 @@ module.exports = function oauthClient(config, initState) { | ||||||
| 			url.search = s; | 			url.search = s; | ||||||
| 		} | 		} | ||||||
| 		let headers = { | 		let headers = { | ||||||
| 			"Authorization": `Bearer ${state.access_token}` | 			"Authorization": `Bearer ${state.access_token}`, | ||||||
|  | 			"Accept": accept == "json" ? "application/json" : "*/*" | ||||||
| 		}; | 		}; | ||||||
| 		let body = data; | 		let body = data; | ||||||
| 		if (type == "json" && body != undefined) { | 		if (type == "json" && body != undefined) { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue