Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Auth to Xhr fetch #1885

Open
CMalmos opened this issue Apr 20, 2023 · 0 comments
Open

Add Auth to Xhr fetch #1885

CMalmos opened this issue Apr 20, 2023 · 0 comments

Comments

@CMalmos
Copy link

CMalmos commented Apr 20, 2023

protobuf.js version: head

it is not possible to make protobuff files private how do i add headers in the fetch lib

i want to be able to do something like
protobbuff.load(url , ... {headers: {Authentication: "Bearer Token"})

and in util/fetch/index.js

fetch_xhr(filename, options, callback)
 xhr.open("GET", filename);

    if (options.headers){
        for (var key in options.headers) {
            if (options.headers.hasOwnProperty(key)) {
                xhr.setRequestHeader(key, options.headers[key]);
            }
        }
    }
    xhr.send();

Or is here another way to do this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant