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

Modernize StripeResponse #932

Merged
merged 1 commit into from
Jan 14, 2020
Merged

Conversation

ob-stripe
Copy link
Contributor

@ob-stripe ob-stripe commented Jan 14, 2020

r? @brandur-stripe @richardm-stripe
cc @stripe/api-libraries

(This PR targets ob-http-headers until it's merged. Please review #931 first.)

Modernizes StripeResponse, by using Lombok to make it into a value class (similar to StripeRequest) and adding a new date() method that returns an Instant instance based on the contents of the Date header.

This is a breaking change, because the two constructors StripeResponse(int, String) and StripeResponse(int, String, Map<String, List<String>>) are replaced by a single constructor StripeResponse(int, HttpHeaders, String). Additionally, null values are rejected for both the headers and body arguments.

This should only affect users manually creating StripeResponse which should only be useful when writing advanced tests. If you don't care about the actual headers or body, it's easy enough to provide empty values for both:

new StripeResponse(200, HttpHeaders.of(Collections.emptyMap()), "")

Copy link
Contributor

@brandur-stripe brandur-stripe left a comment

Choose a reason for hiding this comment

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

Love it. LGTM.

@ob-stripe ob-stripe changed the base branch from ob-http-headers to integration-client-refactor January 14, 2020 22:27
@ob-stripe ob-stripe merged commit 54242b0 into integration-client-refactor Jan 14, 2020
@ob-stripe ob-stripe deleted the ob-stripe-response branch January 14, 2020 22:33
ob-stripe added a commit that referenced this pull request Jan 15, 2020
ob-stripe added a commit that referenced this pull request Jan 15, 2020
ob-stripe added a commit that referenced this pull request Jan 15, 2020
* Refactor form encoding

* Refactor request telemetry

* Move HTTP request methods into new `HttpClient` class

* Add `StripeRequest` object

* Add `HttpClient` abstract class

* Stop disabling the DNS cache

* Fix deprecation warnings (#895)

* Add HttpContent class (#896)

* Add Stopwatch class (#897)

* Move all request properties in `StripeRequest` (#898)

* Remove ApiResource.RequestType (#899)

* Add support for automatic request retries (#900)

* Minor fixes (#902)

* `StringUtils` class & better API key validation (#928)

* Remove support for custom `URLStreamHandler` (#927)

* Refactor HTTP headers handling (#931)

* Add `CaseInsensitiveMap` class

* Add `HttpHeaders` class

* Use `HttpHeaders` in `StripeRequest`

* Use `HttpHeaders` in `StripeResponse`

* Address review comments

* Modernize `StripeResponse` (#932)

* Add `maxNetworkRetries` as a global and per-request setting (#934)

* Add `StreamUtils` class (#935)

* Remove support for `count` and `total_count` in list objects (#936)

* Codegen for openapi e07de1a (#938)

* Update README (#939)

Co-authored-by: remi-stripe <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants