Skip to content

[React Native 0.80.1] Header name must be a non-empty string on Android #6959

@thainx

Description

@thainx

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on. Whenever I receive a response from server request, I got an error saying Header name must be a non-empty string. Android only.

Here is the diff that solved my problem:

diff --git a/node_modules/axios/dist/browser/axios.cjs b/node_modules/axios/dist/browser/axios.cjs
index 01f9185..a26e307 100644
--- a/node_modules/axios/dist/browser/axios.cjs
+++ b/node_modules/axios/dist/browser/axios.cjs
@@ -1747,7 +1747,7 @@ class AxiosHeaders {
 
       setHeaders(obj, valueOrRewrite);
     } else {
-      header != null && setHeader(valueOrRewrite, header, rewrite);
+      !!header && setHeader(valueOrRewrite, header, rewrite);
     }
 
     return this;

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue::bugThis issue is related to a bug that requires fixing

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions