Skip to content

Fix Response Headers to pass the tests#75

Open
dvinubius wants to merge 1 commit intofreeCodeCamp:mainfrom
dvinubius:patch-1
Open

Fix Response Headers to pass the tests#75
dvinubius wants to merge 1 commit intofreeCodeCamp:mainfrom
dvinubius:patch-1

Conversation

@dvinubius
Copy link
Copy Markdown
Contributor

@dvinubius dvinubius commented Nov 15, 2022

There is a test for each of the three post requests (contract call, get balance, transfer) which expects 'Content-Type' to be 'application/json' on the response header. (The test description is misleading though, because is refers to the request header while the fail results from a check on the response header)

The issue comes from Express automatically adding 'charset=UTF-8'.

Checklist:

Closes #XXXXX

There is a test for each of the three post requests (contract call, get balance, transfer) which expects `'Content-Type'` to be `'application/json'` on the response header. (The test description is misleading though, because is refers to the request header)

Express automatically adds `'charset=UTF-8'`, which makes the test fail.

The changes in this PR fix the issue.
@moT01 moT01 requested a review from ShaunSHamilton November 29, 2022 23:59
Copy link
Copy Markdown
Member

@ShaunSHamilton ShaunSHamilton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello there,

Thank you for taking the time to contribute.

As far as I can see, this has no impact on the application whatsoever. The tests are written in the Markdown files, and they get their headers from the _tests array in this file.

Would you mind expanding on what this change is supposed to resolve?


Also, please review the link in the checklist for the recommended PR title.

@dvinubius
Copy link
Copy Markdown
Contributor Author

Hi,
Have you read the commit message?
The issue is not with the app, but with the tests, which don't pass even though the code works correctly.

I think the title is pretty descriptive, maybe you can suggest an improvement, given the suggested changes and the issue that they fix?

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

Successfully merging this pull request may close these issues.

2 participants