Skip to content

Add custom headers #603

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

Closed
alexblack opened this issue Jul 15, 2018 · 10 comments
Closed

Add custom headers #603

alexblack opened this issue Jul 15, 2018 · 10 comments

Comments

@alexblack
Copy link

Is there a way to add additional headers (on the fly, per request) to each http request made by the parse sdk?

I'd love to add a couple headers to identify which of our apps is making the request, and other info like that.

This can be done today with the Android SDK by configuring a network interceptor.

https://stackoverflow.com/questions/47372894/parse-com-android-sdk-okhttp-interceptor

@flovilmart
Copy link
Contributor

At the moment, unfortunately; no.

However it should be pretty simple to add a header provider to it. Is it something you’re willing to contribute back?

@paulovitin
Copy link
Contributor

How can we do this?

// like axios?
Parse.interceptors('request', request => {
	request.headers['foo'] = 'bar';
	return request;
});

@flovilmart
Copy link
Contributor

Seems over complicated as it introduces a new concept

@paulovitin
Copy link
Contributor

@flovilmart if you have any ideas and need help, let me know...

@flovilmart
Copy link
Contributor

On the other end; that could work, perhaps using an event emitter somewhere that emits the request object and let a consumer mutate it

@paulovitin
Copy link
Contributor

paulovitin commented Oct 6, 2018

Something like this?

Parse.on('request', mutator);

@stale
Copy link

stale bot commented Feb 5, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@REPTILEHAUS
Copy link

Also interested in this feature. Is there any way to hook into parse to add custom header to every request from the app ?

@dplewis dplewis removed the wontfix label Dec 24, 2019
@taivo
Copy link

taivo commented Jan 26, 2020

+1 on this. This feature would add a lot of flexibility.

@mogita
Copy link

mogita commented Aug 8, 2020

Upvote for this. In my case, I can easily distinguish requests from my custom express API handlers and the ones made by Parse itself in my Parse hooks. Now they are simply identical.

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

7 participants