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

fix: remove request id when calling the sync api #258

Merged
merged 1 commit into from
Apr 15, 2024

Conversation

beaussan
Copy link
Contributor

Description

This PR introduces changes to the restClient module to handle POST requests to the sync API endpoint differently.

Resolves #257

Changes

  • Export the API_SYNC_BASE_URI constant from the endpoints module to make it accessible in other modules
  • Modify the request function in restClient to skip generating a random request ID for POST requests to the sync API endpoint
  • Add a test case in restClient.test.ts to verify that a random request ID is not created for POST requests to the sync API endpoint

Rationale

The sync API endpoint does not allow a request ID in the CORS headers. To accommodate this, the request function now checks if the baseUri includes the API_SYNC_BASE_URI before generating a random request ID for POST requests. This ensures that POST requests to the sync API endpoint do not include a request ID, while other POST requests continue to generate a random request ID if none is provided.

Testing

A new test case has been added to restClient.test.ts to verify that a random request ID is not created when making a POST request to the sync API endpoint.

Please review the changes and provide any feedback or suggestions.

@scottlovegrove scottlovegrove merged commit acdd681 into Doist:main Apr 15, 2024
1 check passed
@scottlovegrove
Copy link
Contributor

This has been released with version 3.0.3

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.

quickAddTask sends x-requiest-id even if the sync api don't allow it in the cors
2 participants