Skip to content

Fix: Pass api key in headers and detect html error #999

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

Merged
merged 10 commits into from
May 18, 2024

Conversation

ChaituVR
Copy link
Member

Summary:

  • If the API key is passed in the URL, send it in headers
  • Detech if the response is HTML and return an error
  • Fix test cases

How to test:

  • Start your own score API server
  • Change score API to return HTML
  • Change test files in test folder, for example vp.ts with the local score API server

@ChaituVR ChaituVR requested a review from wa0x6e May 17, 2024 18:01
} catch (e) {
return Promise.reject({
code: 500,
message: 'Failed to parse response from score API',
Copy link
Contributor

Choose a reason for hiding this comment

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

Same for message, I think it's available from res, so we could get something more descriptive like Network timeout

Copy link
Member Author

@ChaituVR ChaituVR May 18, 2024

Choose a reason for hiding this comment

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

Passing it in data param, as in this case error will be in HTML and can be unpredictable.if it is not HTML error we handle it seperately

@ChaituVR ChaituVR requested a review from wa0x6e May 18, 2024 03:12
Copy link
Contributor

@wa0x6e wa0x6e left a comment

Choose a reason for hiding this comment

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

utAck

@wa0x6e
Copy link
Contributor

wa0x6e commented May 18, 2024

Just noticed that this issue may be fixed with #957, which goal is to hide the raw response, and convert it to a more concise one

@ChaituVR ChaituVR merged commit e22b836 into master May 18, 2024
2 checks passed
@ChaituVR ChaituVR deleted the fix-send-api-key-in-headers branch May 18, 2024 17:28
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