1
0
mirror of https://github.com/tooot-app/app synced 2025-02-21 14:20:50 +01:00

Added default headers

Like moresci.sale behind Nginx is strict on the headers being present
This commit is contained in:
Zhiyuan Zheng 2021-06-02 22:27:42 +02:00
parent a8ff69952e
commit 9d26053cce
3 changed files with 7 additions and 1 deletions

View File

@ -4,7 +4,7 @@
"native": "210511",
"major": 2,
"minor": 0,
"patch": 3,
"patch": 4,
"expo": "41.0.0"
},
"description": "tooot app for Mastodon",

View File

@ -1,5 +1,6 @@
import axios from 'axios'
import chalk from 'chalk'
import { Constants } from 'react-native-unimodules'
import * as Sentry from 'sentry-expo'
const ctx = new chalk.Instance({ level: 3 })
@ -45,6 +46,8 @@ const apiGeneral = async <T = unknown>({
params,
headers: {
'Content-Type': 'application/json',
'User-Agent': `tooot/${Constants.manifest.version}`,
Accept: '*/*',
...headers
},
...(body && { data: body })

View File

@ -2,6 +2,7 @@ import { RootState } from '@root/store'
import axios, { AxiosRequestConfig } from 'axios'
import chalk from 'chalk'
import li from 'li'
import { Constants } from 'react-native-unimodules'
const ctx = new chalk.Instance({ level: 3 })
@ -67,6 +68,8 @@ const apiInstance = async <T = unknown>({
params,
headers: {
'Content-Type': 'application/json',
'User-Agent': `tooot/${Constants.manifest.version}`,
Accept: '*/*',
...headers,
...(token && {
Authorization: `Bearer ${token}`