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

Log query parameters on HTTP requests #3591

Merged
merged 2 commits into from
Jul 13, 2023

Conversation

MadLittleMods
Copy link
Contributor

@MadLittleMods MadLittleMods commented Jul 12, 2023

Log query parameters on HTTP requests

Follow-up to #3485

Before:

FetchHttpApi: --> GET https://server:8448/some/path
FetchHttpApi: <-- GET https://server:8448/some/path [1234ms 200]

After:

FetchHttpApi: --> GET https://server:8448/some/path?query=xxx
FetchHttpApi: <-- GET https://server:8448/some/path?query=xxx [1234ms 200]

All query parameters values are sanitized to xxx but the existence of the query parameter is helpful to distinguish between requests and a peace of mind sanity check to see that they are on the request. Like initial vs incremental /sync with ?since=xxx. In the future, it would be nice to log more values.

Dev notes

yarn jest spec/unit/http-api/fetch.spec.ts

Checklist

  • Tests written for new code (and old code if feasible)
  • Linter and other CI checks pass
  • Sign-off given on the changes (see CONTRIBUTING.md)

This change is marked as an internal change (Task), so will not be included in the changelog.

@MadLittleMods MadLittleMods added the T-Task Tasks for the team like planning label Jul 12, 2023
@MadLittleMods MadLittleMods marked this pull request as ready for review July 12, 2023 00:13
@MadLittleMods MadLittleMods requested a review from a team as a code owner July 12, 2023 00:13
Copy link
Contributor

@andybalaam andybalaam left a comment

Choose a reason for hiding this comment

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

One minor improvement, but looks good (and safe) overall, thanks!

src/http-api/fetch.ts Outdated Show resolved Hide resolved
@andybalaam
Copy link
Contributor

Btw the Cypress tests are failing for unrelated reasons, so happy to merge when you're ready (ping me).

@@ -300,7 +300,7 @@ describe("FetchHttpApi", () => {
const fetchFn = jest.fn().mockReturnValue(deferred.promise);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

happy to merge when you're ready (ping me).

@andybalaam Feel free to merge whenever 🙂

@andybalaam
Copy link
Contributor

Thank you!

@andybalaam andybalaam added this pull request to the merge queue Jul 13, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 13, 2023
@andybalaam
Copy link
Contributor

This fell out of the merge queue because of known flake element-hq/element-web#25625. Re-adding.

@andybalaam andybalaam added this pull request to the merge queue Jul 13, 2023
Merged via the queue into develop with commit 8ef2e84 Jul 13, 2023
21 checks passed
@andybalaam andybalaam deleted the madlittlemods/log-existence-of-query-params branch July 13, 2023 13:19
@MadLittleMods
Copy link
Contributor Author

Thanks for the review @andybalaam 🐰

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Task Tasks for the team like planning
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants