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

Extract HarRequest object #42

Merged
merged 1 commit into from
Aug 17, 2020
Merged

Extract HarRequest object #42

merged 1 commit into from
Aug 17, 2020

Conversation

JoelQ
Copy link
Contributor

@JoelQ JoelQ commented Aug 17, 2020

🧰 What's being changed?

This pulls out all the request logic from Har to its own object so
it's easier to test variations.

🧪 Testing

This is a pure refactor, there are no behavior changes. New automated unit tests were added around some existing behavior.

Comment on lines +33 to +38
def cookies
to_hash_array(@env.cookies)
end

def http_version
@env.get_header("HTTP_VERSION")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exposing these public methods feels weird. Perhaps this object is playing two roles: Serializing HAR requests, and modeling an HTTP request. I wonder if maybe I should extract another object here. As a bonus, if that's injected into HarRequest, then I can probably pass in a nice double rather than having to construct an env hash every time 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

I see what you mean, but it doesn't feel too off to me. Extracting another object does sound like it'll clean up testing nicely.

This pulls out all the request logic from `Har` to its own object so
it's easier to test variations.
@JoelQ JoelQ merged commit f06a355 into master Aug 17, 2020
@JoelQ JoelQ deleted the jq-extract-request branch August 17, 2020 19:11
djmango pushed a commit to djmango/metrics-sdks that referenced this pull request Sep 19, 2023
Bumps [nock](https://github.com/nock/nock) from 12.0.0 to 12.0.1.
- [Release notes](https://github.com/nock/nock/releases)
- [Changelog](https://github.com/nock/nock/blob/master/CHANGELOG.md)
- [Commits](nock/nock@v12.0.0...v12.0.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
@erunion erunion added ruby Issues related to our Ruby SDK and removed area:ruby labels Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ruby Issues related to our Ruby SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants