Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(core): Fix multipart FormData map field format (#3118)

authored by

Phil Pluckthun and committed by
GitHub
24754437 e996b735

+13 -8
+5
.changeset/friendly-flies-smile.md
··· 1 + --- 2 + '@urql/core': patch 3 + --- 4 + 5 + Fix format of `map` form data field on multipart upload requests. This was erroneously set to a string rather than a string tuple.
+1 -1
packages/core/src/internal/fetchOptions.test.ts
··· 154 154 }); 155 155 156 156 expect(form.get('map')).toMatchInlineSnapshot( 157 - '"{\\"0\\":\\"variables.file\\"}"' 157 + '"{\\"0\\":[\\"variables.file\\"]}"' 158 158 ); 159 159 expect(form.get('0')).toBeInstanceOf(Blob); 160 160 });
+7 -7
packages/core/src/internal/fetchOptions.ts
··· 87 87 const files = extractFiles(body.variables); 88 88 if (files.size) { 89 89 const form = new FormData(); 90 - 91 90 form.append('operations', json); 92 - form.append('map', stringifyVariables({ ...[...files.keys()] })); 93 - 91 + form.append( 92 + 'map', 93 + stringifyVariables({ 94 + ...[...files.keys()].map(value => [value]), 95 + }) 96 + ); 94 97 let index = 0; 95 - for (const file of files.values()) { 96 - form.append(`${index++}`, file); 97 - } 98 - 98 + for (const file of files.values()) form.append(`${index++}`, file); 99 99 return form; 100 100 } 101 101 return json;