Skip to content

Commit 0fa7399

Browse files
authored
Merge pull request #71 from bigcommerce/http-fix
fix(request): CHECKOUT-8092 Fix typo
2 parents e9b1676 + c7cfe44 commit 0fa7399

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/request-sender.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ describe('RequestSender', () => {
118118

119119
it('creates a HTTP request with CSRF token if it exists', () => {
120120
const mockFn = (key: string) => key === 'XSRF-TOKEN' ? 'abc' : undefined;
121+
const relativeUrl = '/v1/endpoint';
121122

122123
/*
123124
* jest.Mocked has a bug with overloads
@@ -131,9 +132,9 @@ describe('RequestSender', () => {
131132
*/
132133
jest.spyOn(cookie, 'get').mockImplementationOnce(mockFn as typeof cookie.get);
133134

134-
requestSender.sendRequest(url);
135+
requestSender.sendRequest(relativeUrl);
135136

136-
expect(requestFactory.createRequest).toHaveBeenCalledWith(url, expect.objectContaining({
137+
expect(requestFactory.createRequest).toHaveBeenCalledWith(relativeUrl, expect.objectContaining({
137138
headers: expect.objectContaining({
138139
'X-XSRF-TOKEN': 'abc',
139140
}),

src/request-sender.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,6 @@ export default class RequestSender {
146146
return true;
147147
}
148148

149-
return !url.match(new RegExp('^(htttps?:)?\/\/'));
149+
return !url.match(new RegExp('^(https?:)?\/\/'));
150150
}
151151
}

0 commit comments

Comments
 (0)