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

Feature: CAM-4069 I can set custom request headers using the HTTP-Client in JS SDK #11

Conversation

@lightswitch05
Copy link
Contributor

lightswitch05 commented Nov 19, 2015

I need custom headers to allow authentication through a gateway. I saw there was already an open ticket for this feature: CAM-4069

Example usage:

var sdkClient = new CamSDK.Client({
    apiUri: 'http://example.com:8080/engine-rest',
    mock: false,
    headers: {'X-Requested-With': 'AngularJs'}
});
@SebastianStamm SebastianStamm self-assigned this Nov 20, 2015
@SebastianStamm

This comment has been minimized.

Copy link
Contributor

SebastianStamm commented Nov 20, 2015

Thank you for the pull request! The code itself looks fine, but it would be awesome if you could provide some test cases for this feature.

@lightswitch05

This comment has been minimized.

Copy link
Contributor Author

lightswitch05 commented Nov 20, 2015

I agree that tests are needed. Unfortunately the current mocking strategy for tests makes it impossible to test anything in HttpClient

@SebastianStamm

This comment has been minimized.

Copy link
Contributor

SebastianStamm commented Nov 20, 2015

Then we should have a look at how we do the testing to make it possible :)

We are currently busy finishing the 7.4 release, but should be able to have a look at it next month.

@lightswitch05

This comment has been minimized.

Copy link
Contributor Author

lightswitch05 commented Nov 20, 2015

My vote is to use superagent-mock and completly remove HttpClientMock, but that would take more time then I have to spend on this. If this route were taken, it would allow more tests to be added involving promises for my other pull request.

This was a pretty urgent requirement for us, so we're going to be using it already, but that doesn't really count as testing.

@meyerdan

This comment has been minimized.

Copy link
Member

meyerdan commented Nov 24, 2015

+1 for removing the HttpClientMock

@SebastianStamm

This comment has been minimized.

Copy link
Contributor

SebastianStamm commented Dec 7, 2015

I updated superagent and replaced the mocking strategy with superagent-mock. I also added a small utility to test the header before sending it.

Merged with 3352110

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.