Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Add custom header in the batch request #1097

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wanglw
Copy link

@wanglw wanglw commented Nov 1, 2018

No description provided.

@cfdreddbot
Copy link
Collaborator

Hey wanglw!

Thanks for submitting this pull request!

All pull request submitters and commit authors must have a Contributor License Agreement (CLA) on-file with us. Please have everyone sign the appropriate CLA (individual or corporate), and send to: contributors@cloudfoundry.org.

When sending a signed CLA please provide your github username in case of an individual CLA or the list of github usernames that can make pull requests on behalf of your organization.

The following github user @wanglw has not signed the appropriate CLA.

If you are confident that everyone listed is covered under a Corporate CLA, please make sure everyone has publicized their membership in the appropriate Github Org, per these instructions.

Once everyone has publicized their membership, one of the owners of this repository can close and reopen this pull request, and dreddbot will take another look.

@cf-gitbot
Copy link
Collaborator

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/161644021

The labels on this github issue will be updated when the story is started.

@codecov
Copy link

codecov bot commented Nov 1, 2018

Codecov Report

Merging #1097 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1097   +/-   ##
=======================================
  Coverage   95.21%   95.21%           
=======================================
  Files         126      126           
  Lines        3509     3509           
=======================================
  Hits         3341     3341           
  Misses        168      168

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a48be75...5a6b2c7. Read the comment docs.

@hsiliev
Copy link
Contributor

hsiliev commented Nov 1, 2018

Can you please point out how adding customHeader works? Is this handled by request or express module?

@wanglw
Copy link
Author

wanglw commented Nov 22, 2018

@hsiliev Based on my understanding, I think it is handled by request.

Code level:
In our example, we get the customHeader in our code like this:

var myHeader = req.customHeader["if-match"] ? req.customHeader["if-match"] : "";

Example:
POST http://localhost:11443/batch
body includes the customeHeader:

[
    {
        "method": "PUT",
        "uri": "XXXXXXXX",
        "body": {
        	"test_id": "TEST",
        	"state": "test"
        },
        "headers": {
        	"if-match": "7-0b6a49e921a6a9214a5503e29adcc7eb"
        }
    }
]

@hsiliev
Copy link
Contributor

hsiliev commented Nov 22, 2018

I don't see customHeader in the source of request (nor in express) and that's why I asked.

In fact the docs mention only headers option (https://github.com/request/request#custom-http-headers), so I think the change should actually be:

headers: r.headers

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

Successfully merging this pull request may close these issues.

4 participants