mirror of
https://github.com/tooot-app/app
synced 2025-02-18 12:50:46 +01:00
Proper content type header for Android
This commit is contained in:
parent
b2043d884f
commit
dce3e95010
@ -1,7 +1,6 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import chalk from 'chalk'
|
import chalk from 'chalk'
|
||||||
import Constants from 'expo-constants'
|
import Constants from 'expo-constants'
|
||||||
import * as Sentry from 'sentry-expo'
|
|
||||||
|
|
||||||
const ctx = new chalk.Instance({ level: 3 })
|
const ctx = new chalk.Instance({ level: 3 })
|
||||||
|
|
||||||
@ -14,7 +13,6 @@ export type Params = {
|
|||||||
}
|
}
|
||||||
headers?: { [key: string]: string }
|
headers?: { [key: string]: string }
|
||||||
body?: FormData | Object
|
body?: FormData | Object
|
||||||
sentry?: boolean
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const apiGeneral = async <T = unknown>({
|
const apiGeneral = async <T = unknown>({
|
||||||
@ -23,8 +21,7 @@ const apiGeneral = async <T = unknown>({
|
|||||||
url,
|
url,
|
||||||
params,
|
params,
|
||||||
headers,
|
headers,
|
||||||
body,
|
body
|
||||||
sentry = true
|
|
||||||
}: Params): Promise<{ body: T }> => {
|
}: Params): Promise<{ body: T }> => {
|
||||||
console.log(
|
console.log(
|
||||||
ctx.bgGreen.bold(' API general ') +
|
ctx.bgGreen.bold(' API general ') +
|
||||||
@ -45,7 +42,10 @@ const apiGeneral = async <T = unknown>({
|
|||||||
url,
|
url,
|
||||||
params,
|
params,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type':
|
||||||
|
body && body instanceof FormData
|
||||||
|
? 'multipart/form-data'
|
||||||
|
: 'application/json',
|
||||||
'User-Agent': `tooot/${Constants.manifest?.version}`,
|
'User-Agent': `tooot/${Constants.manifest?.version}`,
|
||||||
Accept: '*/*',
|
Accept: '*/*',
|
||||||
...headers
|
...headers
|
||||||
|
@ -3,7 +3,6 @@ import axios, { AxiosRequestConfig } from 'axios'
|
|||||||
import chalk from 'chalk'
|
import chalk from 'chalk'
|
||||||
import Constants from 'expo-constants'
|
import Constants from 'expo-constants'
|
||||||
import li from 'li'
|
import li from 'li'
|
||||||
import * as Sentry from 'sentry-expo'
|
|
||||||
|
|
||||||
const ctx = new chalk.Instance({ level: 3 })
|
const ctx = new chalk.Instance({ level: 3 })
|
||||||
|
|
||||||
@ -73,7 +72,10 @@ const apiInstance = async <T = unknown>({
|
|||||||
url,
|
url,
|
||||||
params,
|
params,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type':
|
||||||
|
body && body instanceof FormData
|
||||||
|
? 'multipart/form-data'
|
||||||
|
: 'application/json',
|
||||||
'User-Agent': `tooot/${Constants.manifest?.version}`,
|
'User-Agent': `tooot/${Constants.manifest?.version}`,
|
||||||
Accept: '*/*',
|
Accept: '*/*',
|
||||||
...headers,
|
...headers,
|
||||||
|
@ -48,7 +48,10 @@ const apiTooot = async <T = unknown>({
|
|||||||
url: `${url}`,
|
url: `${url}`,
|
||||||
params,
|
params,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type':
|
||||||
|
body && body instanceof FormData
|
||||||
|
? 'multipart/form-data'
|
||||||
|
: 'application/json',
|
||||||
'User-Agent': `tooot/${Constants.manifest?.version}`,
|
'User-Agent': `tooot/${Constants.manifest?.version}`,
|
||||||
Accept: '*/*',
|
Accept: '*/*',
|
||||||
...headers
|
...headers
|
||||||
|
@ -3963,9 +3963,9 @@ flow-parser@^0.121.0:
|
|||||||
integrity sha512-1gIBiWJNR0tKUNv8gZuk7l9rVX06OuLzY9AoGio7y/JT4V1IZErEMEq2TJS+PFcw/y0RshZ1J/27VfK1UQzYVg==
|
integrity sha512-1gIBiWJNR0tKUNv8gZuk7l9rVX06OuLzY9AoGio7y/JT4V1IZErEMEq2TJS+PFcw/y0RshZ1J/27VfK1UQzYVg==
|
||||||
|
|
||||||
follow-redirects@^1.14.9:
|
follow-redirects@^1.14.9:
|
||||||
version "1.14.9"
|
version "1.15.0"
|
||||||
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.9.tgz#dd4ea157de7bfaf9ea9b3fbd85aa16951f78d8d7"
|
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.0.tgz#06441868281c86d0dda4ad8bdaead2d02dca89d4"
|
||||||
integrity sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==
|
integrity sha512-aExlJShTV4qOUOL7yF1U5tvLCB0xQuudbf6toyYA0E/acBNw71mvjFTnLaRp50aQaYocMR0a/RMMBIHeZnGyjQ==
|
||||||
|
|
||||||
fontfaceobserver@^2.1.0:
|
fontfaceobserver@^2.1.0:
|
||||||
version "2.1.0"
|
version "2.1.0"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user