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 global replace for processing raw headers #496

Merged
merged 1 commit into from Apr 8, 2017

Conversation

kwgithubusername
Copy link
Contributor

@mislav @mpfluger

Added global replace as @pseidemann mentioned.
#491 (comment)

Not sure how you would want to expose parseHeaders for testing but here are some suggestions for tests:

suite('parseHeaders', function() {
  test('parses raw headers with line feed'), function() {
    var rawHeaders = 'Tolerance-Provision-Value-1: key1\nTolerance-Provision-Value-2: key2\nTolerance-Provision-Value-3: key3'
    var headers = parseHeaders(rawHeaders);
    assert.equal(headers.get('Tolerance-Provision-Value-1'),'key1')
    assert.equal(headers.get('Tolerance-Provision-Value-2'),'key2')
    assert.equal(headers.get('Tolerance-Provision-Value-3'),'key3')
  })
  test('parses raw headers with carriage return line feed'), function() {
    var rawHeaders = 'Basic-Rules-Value-1: key1\r\nBasic-Rules-Value-2: key2\r\nBasic-Rules-Value-3: key3'
    var headers = parseHeaders(rawHeaders);
    assert.equal(headers.get('Basic-Rules-Value-1'),'key1')
    assert.equal(headers.get('Basic-Rules-Value-2'),'key2')
    assert.equal(headers.get('Basic-Rules-Value-3'),'key3')
  })
  test('parses raw headers with obs-fold'), function() {
    var rawHeaders = 'Obs-Fold-Value: key1\r\n key2\r\n key3'
    var headers = parseHeaders(rawHeaders);
    assert.equal(headers.get('Obs-Fold-Value'),'key1 key2 key3')
  })
})

@mislav mislav merged commit 08602ff into JakeChampion:master Apr 8, 2017
@mislav
Copy link
Contributor

mislav commented Apr 8, 2017

Thanks for the fix! Unfortunately, it's not easy to test this with our current setup, so let's get this in without tests. If only Node let us supply our own response headers in raw format, then it would be easier to test this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants