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

solve hostHeader.startsWith is not a function #5

Open
sunjiaheng7825 opened this issue Dec 9, 2020 · 0 comments
Open

solve hostHeader.startsWith is not a function #5

sunjiaheng7825 opened this issue Dec 9, 2020 · 0 comments

Comments

@sunjiaheng7825
Copy link

sunjiaheng7825 commented Dec 9, 2020

index.js 38line

const headers = request.headers || {}

http header is different to aws lambda event header

aws lambda event header:

"age": [
      {
        "key": "Age",
        "value": "2402"
     }
  ]
}

so need add function to rebuild http header,

function rebuildHeader(headers) {
    var newHeaders = {}

    for (var key in headers) {
        var keyValue = headers[key]
        var value = keyValue[0].value
        newHeaders[key] = value
    }

    return newHeaders
}

index.js 38line

const headers = rebuildHeader(request.headers)

If you think it’s ok, please modify it

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