Skip to content

Commit

Permalink
Changelog and docs for preserveHeaderCase (#10111)
Browse files Browse the repository at this point in the history
* Changelog

* Add only to http-link doc

* Batch, httpLink constructor, and adv. networking
  • Loading branch information
MrDoomBringer authored Nov 29, 2022
1 parent d54cf70 commit e9bc980
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
- Support `onError` callback for `useSubscription` hook. <br/>
[@jeroenvisser101](https://github.com/jeroenvisser101) in [#9495](https://github.com/apollographql/apollo-client/pull/9495)

- Implement `preserveHeaderCase` option for `http` context object, enabling preserved header capitalization for non-http-spec-compliant servers. <br/>
[@mrdoombringer](https://github.com/mrdoombringer) in [#9891](https://github.com/apollographql/apollo-client/pull/9891)
### Improvements

- Delay calling `onCompleted` and `onError` callbacks passed to `useQuery` using `Promise.resolve().then(() => ...)` to fix issue [#9794](https://github.com/apollographql/apollo-client/pull/9794). <br/>
Expand Down
19 changes: 18 additions & 1 deletion docs/source/api/link/apollo-link-batch-http.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,21 @@ An object representing headers to include in every HTTP request, such as `{Authe
<tr>
<td>

###### `preserveHeaderCase`

`Boolean`
</td>
<td>

If set to true, header names won't be automatically normalized to lowercase. This allows for non-http-spec-compliant servers that might expect capitalized header names.

The default value is `false`.
</td>
</tr>

<tr>
<td>

###### `credentials`

`String`
Expand Down Expand Up @@ -227,11 +242,13 @@ operation.setContext({
})
```

The context `http` object currently supports two keys:
From the context `http` object:

* `includeExtensions`: Send the extensions object for this request.
* `includeQuery`: Don't send the `query` field for this request.

See the [http option fields](https://www.apollographql.com/docs/react/api/link/apollo-link-http/#http-option-fields) for more information.

One way to use persisted queries is with [apollo-link-persisted-queries](https://www.apollographql.com/docs/react/api/link/persisted-queries) and [Apollo Server](/apollo-server/performance/apq/).

## Custom fetching
Expand Down
29 changes: 29 additions & 0 deletions docs/source/api/link/apollo-link-http.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,20 @@ An object representing headers to include in every HTTP request, such as `{Autho
</td>
</tr>

<tr>
<td>

###### `preserveHeaderCase`

`Boolean`
</td>
<td>

If set to true, header names won't be automatically normalized to lowercase. This allows for non-http-spec-compliant servers that might expect capitalized header names.

The default value is `false`.
</td>
</tr>

<tr>
<td>
Expand Down Expand Up @@ -317,6 +331,21 @@ The default value is `true`.
</td>
</tr>

<tr>
<td>

###### `preserveHeaderCase`

`Boolean`
</td>
<td>

If set to true, header names won't be automatically normalized to lowercase. This allows for non-http-spec-compliant servers that might expect capitalized header names.

The default value is `false`.
</td>
</tr>

</tbody>
</table>

Expand Down
1 change: 1 addition & 0 deletions docs/source/networking/advanced-http-networking.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ The `HttpLink` constructor accepts the following options:
| `includeExtensions` | If `true`, you can pass an `extensions` field to your GraphQL server. (default: `false`) |
| `fetch` | A `fetch`-compatible API for making a request. See [Providing a `fetch` replacement for certain environments](#providing-a-fetch-replacement-for-certain-environments). |
| `headers` | An object containing header names and values to include in each request. |
| `preserveHeaderCase` | If `true`, header values retain their capitalization for non-http-spec-compliant servers. (default: `false`) |
| `credentials` | A string representing the credentials policy to use for the `fetch` call. (valid values: `omit`, `include`, `same-origin`) |
| `fetchOptions` | Include this to override the values of certain options that are provided to the `fetch` call. |
| `useGETForQueries` | If `true`, `HttpLink` uses `GET` requests instead of `POST` requests to execute query operations (but not mutation operations). (default: `false`) |
Expand Down

0 comments on commit e9bc980

Please sign in to comment.