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

[NT] Optional proxy server for draft endpoints #2070

Merged
merged 3 commits into from
Oct 12, 2023

Conversation

timdawborn
Copy link
Contributor

@timdawborn timdawborn commented Oct 10, 2023

Description, Motivation and Context

This PR introduces a new option, --proxyMockBaseUrl, which can be used to proxy requests for draft contracts to a HTTP server instead of returning mocked response. With this, we now have the functionality to have a local implementation of a particular new draft contract while using existing live implementations for all other contracts and non-contract requests. For example, what I've been using this for locally is:

spot mock \
    --port 5601 \
    --proxyBaseUrl https://api.dev.company.com \
    --proxyFallbackBaseUrl https://api.dev.company.com \
    --proxyMockBaseUrl http://127.0.0.1:3000 \  # Hit a locally running server for draft requests
    ~/some/path/to/spots/api.ts

The diff of this PR is best viewed with whitespace ignored, as there's a large block of indentation changes: https://github.com/airtasker/spot/pull/2070/files?diff=split&w=1

Checklist:

  • I've added/updated tests to cover my changes
  • I've created an issue associated with this PR

@timdawborn timdawborn marked this pull request as ready for review October 11, 2023 04:12
@timdawborn timdawborn requested a review from a team as a code owner October 11, 2023 04:12
@timdawborn timdawborn requested review from njday and flavray and removed request for a team October 11, 2023 04:12
Copy link
Contributor

@flavray flavray left a comment

Choose a reason for hiding this comment

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

Neat, LGTM 👍

generateData(TypeTable.fromArray(api.types), response.body.type)
)
);
// For draft endpoints, either either proxy or generate a mocked response.
Copy link

Choose a reason for hiding this comment

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

Typo: either either

Copy link

@njday njday left a comment

Choose a reason for hiding this comment

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

LGTM

@timdawborn timdawborn merged commit b455e5f into master Oct 12, 2023
3 checks passed
@timdawborn timdawborn deleted the no-ticket-proxy-server-for-draft-endpoints branch October 12, 2023 02:50
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.

3 participants