From 34f4771e24ff1a19f356530c98ec5bd7058183d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Lisowski?= Date: Mon, 30 Nov 2020 20:39:46 +0100 Subject: [PATCH] fix(utils/web): Fix typo in Content-Type header Reasons: - RFC says it's Content-Type, not Content-type - node-fetch package is checking for the `Content-Type` header in a case sensitive manner and overwrites it when cannot find it https://github.com/node-fetch/node-fetch/blob/master/src/request.js#L71 - because of the node-fetch Content-Type check, the header is sometimes overwritten and near-api-js call is not always recognized as application/json request --- src/utils/web.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/web.ts b/src/utils/web.ts index 56ce55dde1..87c2bc9d87 100644 --- a/src/utils/web.ts +++ b/src/utils/web.ts @@ -56,7 +56,7 @@ export async function fetchJson(connection: string | ConnectionInfo, json?: stri const response = await fetch(url, { method: json ? 'POST' : 'GET', body: json ? json : undefined, - headers: { 'Content-type': 'application/json; charset=utf-8' } + headers: { 'Content-Type': 'application/json; charset=utf-8' } }); if (!response.ok) { if (response.status === 503) {