nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: urql-graphql/urql
Pull request #3118 (2023-03-31 20:25:52)

fix(core): Fix multipart FormData map field format
## Summary

The multipart request spec actually specifies that `map` is of type `Record<string, string[]>` rather than `Record<string, string>`. While this is easy to miss, it's likely for upload deduplication, which we don't do but have to respect.

## Set of changes

- Convert `FormData` `map` field to `[prop: string]: [string]`



Patch:
diff --git a/.changeset/friendly-flies-smile.md b/.changeset/friendly-flies-smile.md
new file mode 100644
index 00000000..6dae8a34
--- /dev/null
+++ b/.changeset/friendly-flies-smile.md
@@ -0,0 +1,5 @@
+---
+'@urql/core': patch
+---
+
+Fix format of `map` form data field on multipart upload requests. This was erroneously set to a string rather than a string tuple.
diff --git a/packages/core/src/internal/fetchOptions.ts b/packages/core/src/internal/fetchOptions.ts
index 7aa6513f..f08ed0e7 100644
--- a/packages/core/src/internal/fetchOptions.ts
+++ b/packages/core/src/internal/fetchOptions.ts
@@ -87,15 +87,15 @@ const serializeBody = (
     const files = extractFiles(body.variables);
     if (files.size) {
       const form = new FormData();
-
       form.append('operations', json);
-      form.append('map', stringifyVariables({ ...[...files.keys()] }));
-
+      form.append(
+        'map',
+        stringifyVariables({
+          ...[...files.keys()].map(value => [value]),
+        })
+      );
       let index = 0;
-      for (const file of files.values()) {
-        form.append(`${index++}`, file);
-      }
-
+      for (const file of files.values()) form.append(`${index++}`, file);
       return form;
     }
     return json;


Test patch:
diff --git a/packages/core/src/internal/fetchOptions.test.ts b/packages/core/src/internal/fetchOptions.test.ts
index 245efdbc..bade73cf 100644
--- a/packages/core/src/internal/fetchOptions.test.ts
+++ b/packages/core/src/internal/fetchOptions.test.ts
@@ -154,7 +154,7 @@ describe('makeFetchOptions', () => {
     });
 
     expect(form.get('map')).toMatchInlineSnapshot(
-      '"{\\"0\\":\\"variables.file\\"}"'
+      '"{\\"0\\":[\\"variables.file\\"]}"'
     );
     expect(form.get('0')).toBeInstanceOf(Blob);
   });
Repository: urql-graphql/urql
Pull request #3770 (2025-04-02 09:30:00)

fix(core): Use `console.debug` verbosity in `debugExchange`
See #3660

changeset-bot[bot]: ###  🦋  Changeset detected

Latest commit: 0541a221173f5af0661eed81331d174ccf6ea147

**The changes in this PR will be included in the next version bump.**

<details><summary>This PR includes changesets to release 1 package</summary>

  | Name       | Type  |
| ---------- | ----- |
| @urql/core | Patch |

</details>

Not sure what this means? [Click here  to learn what changesets are](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md).

[Click here if you're a maintainer who wants to add another changeset to this PR](https://github.com/urql-graphql/urql/new/@kitten/fix/pr-3660-console-debug?filename=.changeset/angry-lobsters-flash.md&value=---%0A%22%40urql%2Fcore%22%3A%20patch%0A---%0A%0Afix(core)%3A%20Use%20%60console.debug%60%20verbosity%20in%20%60debugExchange%60%0A)



Patch:
diff --git a/.changeset/serious-chefs-march.md b/.changeset/serious-chefs-march.md
new file mode 100644
index 00000000..d1a1fe3a
--- /dev/null
+++ b/.changeset/serious-chefs-march.md
@@ -0,0 +1,5 @@
+---
+'@urql/core': patch
+---
+
+Change debug log verbosity to `console.debug` rather than `console.log`
diff --git a/packages/core/src/exchanges/debug.ts b/packages/core/src/exchanges/debug.ts
index d0b5dd47..64306dc4 100644
--- a/packages/core/src/exchanges/debug.ts
+++ b/packages/core/src/exchanges/debug.ts
@@ -23,11 +23,11 @@ export const debugExchange: Exchange = ({ forward }) => {
       pipe(
         ops$,
         // eslint-disable-next-line no-console
-        tap(op => console.log('[Exchange debug]: Incoming operation: ', op)),
+        tap(op => console.debug('[Exchange debug]: Incoming operation: ', op)),
         forward,
         tap(result =>
           // eslint-disable-next-line no-console
-          console.log('[Exchange debug]: Completed operation: ', result)
+          console.debug('[Exchange debug]: Completed operation: ', result)
         )
       );
   }


Test patch:
diff --git a/packages/core/src/exchanges/debug.test.ts b/packages/core/src/exchanges/debug.test.ts
index fb8d930d..af119408 100644
--- a/packages/core/src/exchanges/debug.test.ts
+++ b/packages/core/src/exchanges/debug.test.ts
@@ -29,7 +29,7 @@ beforeEach(() => {
 });
 
 it('forwards query operations correctly', async () => {
-  vi.spyOn(globalThis.console, 'log').mockImplementation(() => {
+  vi.spyOn(globalThis.console, 'debug').mockImplementation(() => {
     /** Do NOthing */
   });
   const { source: ops$, next, complete } = input;
@@ -39,9 +39,9 @@ it('forwards query operations correctly', async () => {
   next(queryOperation);
   complete();
   // eslint-disable-next-line no-console
-  expect(console.log).toBeCalled();
+  expect(console.debug).toBeCalled();
   // eslint-disable-next-line no-console
-  expect(console.log).toBeCalledTimes(2);
+  expect(console.debug).toBeCalledTimes(2);
 });
 
 describe('production', () => {