Merge pull request #92 from cloudflare/sven/revert

Revert "add content-type in image upload"
pull/94/head
Sven Sauleau 2023-01-12 13:30:39 +01:00 zatwierdzone przez GitHub
commit 1d5f4b0b0d
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 1 dodań i 4 usunięć

Wyświetl plik

@ -29,7 +29,6 @@ export async function uploadImage(file: File, config: Config): Promise<URL> {
method: 'POST',
body: formData,
headers: {
'content-type': file.type,
authorization: 'Bearer ' + config.apiToken,
},
})

Wyświetl plik

@ -12,10 +12,8 @@ const domain = 'cloudflare.com'
describe('Mastodon APIs', () => {
describe('media', () => {
test('upload image creates object', async () => {
globalThis.fetch = async (input: RequestInfo, data: any) => {
globalThis.fetch = async (input: RequestInfo) => {
if (input === 'https://api.cloudflare.com/client/v4/accounts/testaccountid/images/v1') {
assert.equal(data.headers['content-type'], 'image/jpeg')
return new Response(
JSON.stringify({
success: true,