Skip to content

Commit

Permalink
Merge branch 'amazon_follow_up' of github.com:recurly/recurly-js into…
Browse files Browse the repository at this point in the history
… amazon_follow_up
  • Loading branch information
arzitney committed Oct 2, 2023
2 parents d061310 + e081825 commit 87705a7
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 4 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## [v4.25.10](https://github.com/recurly/recurly-js/tree/v4.25.10) (2023-09-27)

[Full Changelog](https://github.com/recurly/recurly-js/compare/v4.25.9...v4.25.10)


**Merged Pull Requests**

- Adds hostname configuration pass-through [#851](https://github.com/recurly/recurly-js/pull/851) ([chrissrogers](https://github.com/chrissrogers))
- Updated images for iOS-15-Remote Browser for e2e tests [#850](https://github.com/recurly/recurly-js/pull/850) ([arzitney](https://github.com/arzitney))
- Add Amazon Pay [#848](https://github.com/recurly/recurly-js/pull/848) ([gilv93](https://github.com/gilv93))



## [v4.25.9](https://github.com/recurly/recurly-js/tree/v4.25.9) (2023-09-07)

[Full Changelog](https://github.com/recurly/recurly-js/compare/v4.25.8...v4.25.9)
Expand Down
2 changes: 2 additions & 0 deletions lib/recurly.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ export class Recurly extends Emitter {

if (options.publicKey) {
this.config.publicKey = options.publicKey;
} else if (options.hostname) {
this.config.hostname = options.hostname;
} else if (!this.config.publicKey) {
throw errors('config-missing-public-key');
}
Expand Down
4 changes: 4 additions & 0 deletions lib/recurly/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@ export class Request {
}
};

if (this.recurly.config.hostname && req.setRequestHeader) {
req.setRequestHeader('Recurly-Credential-Checkout-Hostname', this.recurly.config.hostname);
}

// XDR requests will abort if too many are sent simultaneously
setTimeout(() => {
if (method === 'post') {
Expand Down
2 changes: 1 addition & 1 deletion lib/recurly/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
* Current package/component version.
*/

module.exports = '4.25.9';
module.exports = '4.25.10';
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "recurly.js",
"description": "Zen subscription billing in the browser",
"version": "4.25.9",
"version": "4.25.10",
"license": "MIT",
"main": "recurly.js",
"repository": {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions test/unit/request.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,13 @@ describe('Request', () => {
beforeEach(function () {
sinon.spy(this.XHR.prototype, 'open');
sinon.spy(this.XHR.prototype, 'send');
sinon.spy(this.XHR.prototype, 'setRequestHeader');
});

afterEach(function () {
this.XHR.prototype.open.restore();
this.XHR.prototype.send.restore();
this.XHR.prototype.setRequestHeader.restore();
});

describe('when performing a POST request', () => {
Expand All @@ -271,6 +273,14 @@ describe('Request', () => {
assert(this.XHR.prototype.send.calledWith());
});
});

describe('when configured with a hostname', () => {
it('Applies the hostname as a header', function () {
this.recurly.configure({ hostname: 'test-hostname.recurly.com' });
this.request.request({ method: 'get', route: 'test' });
assert(this.XHR.prototype.setRequestHeader.calledWithMatch('Recurly-Credential-Checkout-Hostname', 'test-hostname.recurly.com'));
});
});
});
});
});
Expand Down

0 comments on commit 87705a7

Please sign in to comment.