Skip to content

Commit 641bdd2

Browse files
author
Patrick Sachs
committed
Fixed: Invalid utf-8 in accept header
1 parent ca5991e commit 641bdd2

File tree

5 files changed

+8
-4
lines changed

5 files changed

+8
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
- Nothing so far
66

7+
## 2.2.1
8+
9+
- Fixed inavlid usage of `charset=utf-8` in the accept header when sending a JSON request
10+
711
## 2.2.0
812

913
- Allow setting default options for URLs. By @MatthiasDummler

dist/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ exports.json = function (req, _a) {
218218
if (init.headers) {
219219
mergeHeaders(headers, init.headers);
220220
}
221-
headers.set('accept', JSON_CONTENT_TYPE_UTF8);
221+
headers.set('accept', JSON_CONTENT_TYPE_BASIC);
222222
headers.set('content-type', JSON_CONTENT_TYPE_UTF8);
223223
init = __assign(__assign({}, init), { body: body, headers: headers });
224224
return [4 /*yield*/, exports.ajax(req, init)];

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sahnee/ajax",
3-
"version": "2.2.0",
3+
"version": "2.2.1",
44
"description": "A dependency-free utility library for making AJAX requests in JavaScript & TypeScript.",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export const json = async <T>(req: AjaxURL, { json, ...init }: AjaxRequestInit &
208208
if (init.headers) {
209209
mergeHeaders(headers, init.headers);
210210
}
211-
headers.set('accept', JSON_CONTENT_TYPE_UTF8)
211+
headers.set('accept', JSON_CONTENT_TYPE_BASIC)
212212
headers.set('content-type', JSON_CONTENT_TYPE_UTF8)
213213
init = {
214214
...init,

0 commit comments

Comments
 (0)