Skip to content

Fix requests patching edge case #146

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 5 commits into from
Jan 11, 2021

Conversation

DarcyRaynerDD
Copy link
Contributor

What does this PR do?

Fixes the x-ray only http patching behavior, to account for broken case.

Motivation

Issue #134

Testing Guidelines

In addition to the new test cases, I've tested this manually in a lambda and verified the request was able to complete correctly.

Additional Notes

Types of Changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog
  • This PR passes the integration tests (ask a Datadog member to run the tests)

@DarcyRaynerDD DarcyRaynerDD requested a review from a team as a code owner January 11, 2021 18:26
@codecov-io
Copy link

codecov-io commented Jan 11, 2021

Codecov Report

Merging #146 (0634a4b) into main (7d1b8a7) will increase coverage by 0.30%.
The diff coverage is 90.90%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #146      +/-   ##
==========================================
+ Coverage   87.65%   87.95%   +0.30%     
==========================================
  Files          29       29              
  Lines         972      980       +8     
  Branches      169      169              
==========================================
+ Hits          852      862      +10     
+ Misses         82       81       -1     
+ Partials       38       37       -1     
Impacted Files Coverage Δ
src/trace/patch-http.ts 77.58% <90.90%> (+7.58%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7d1b8a7...0634a4b. Read the comment docs.


if (isIntegrationTest()) {
_logHttpRequest(requestOpts);
if (arg3 === undefined || arg3 === null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would add a comment here explaining why this is necessary

options = { ...options, ...arg2 };

let requestOpts: http.RequestOptions | undefined;
if (typeof arg1 === "string" || arg1 instanceof URL) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Likewise I might add comments here to describe the different cases

@DarcyRaynerDD DarcyRaynerDD merged commit 82364f0 into main Jan 11, 2021
@DarcyRaynerDD DarcyRaynerDD deleted the darcy.rayner/fix-requests-patching branch January 11, 2021 20:01
Czechh added a commit that referenced this pull request Jan 11, 2021
* main:
  Bump version to 3.42.0
  Fix requests patching edge case (#146)
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