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

fix(utils): Consider 429 responses in transports #5062

Merged
merged 6 commits into from
May 11, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add http tests
lforst committed May 10, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit a8b7661430665debe2f8518060f5255ca4493b69
13 changes: 5 additions & 8 deletions packages/node/test/transports/http.test.ts
Original file line number Diff line number Diff line change
@@ -237,10 +237,7 @@ describe('makeNewHttpTransport()', () => {
it('should register TransportRequestExecutor that returns the correct object from server response (rate limit)', async () => {
await setupTestServer({
statusCode: RATE_LIMIT,
responseHeaders: {
'Retry-After': '2700',
'X-Sentry-Rate-Limits': '60::organization, 2700::organization',
},
responseHeaders: {},
});

makeNodeTransport(defaultOptions);
@@ -253,10 +250,7 @@ describe('makeNewHttpTransport()', () => {

await expect(executorResult).resolves.toEqual(
expect.objectContaining({
headers: {
'retry-after': '2700',
'x-sentry-rate-limits': '60::organization, 2700::organization',
},
statusCode: RATE_LIMIT,
}),
);
});
@@ -276,6 +270,7 @@ describe('makeNewHttpTransport()', () => {

await expect(executorResult).resolves.toEqual(
expect.objectContaining({
statusCode: SUCCESS,
headers: {
'retry-after': null,
'x-sentry-rate-limits': null,
@@ -303,6 +298,7 @@ describe('makeNewHttpTransport()', () => {

await expect(executorResult).resolves.toEqual(
expect.objectContaining({
statusCode: SUCCESS,
headers: {
'retry-after': '2700',
'x-sentry-rate-limits': '60::organization, 2700::organization',
@@ -330,6 +326,7 @@ describe('makeNewHttpTransport()', () => {

await expect(executorResult).resolves.toEqual(
expect.objectContaining({
statusCode: RATE_LIMIT,
headers: {
'retry-after': '2700',
'x-sentry-rate-limits': '60::organization, 2700::organization',
13 changes: 5 additions & 8 deletions packages/node/test/transports/https.test.ts
Original file line number Diff line number Diff line change
@@ -290,10 +290,7 @@ describe('makeNewHttpsTransport()', () => {
it('should register TransportRequestExecutor that returns the correct object from server response (rate limit)', async () => {
await setupTestServer({
statusCode: RATE_LIMIT,
responseHeaders: {
'Retry-After': '2700',
'X-Sentry-Rate-Limits': '60::organization, 2700::organization',
},
responseHeaders: {},
});

makeNodeTransport(defaultOptions);
@@ -306,10 +303,7 @@ describe('makeNewHttpsTransport()', () => {

await expect(executorResult).resolves.toEqual(
expect.objectContaining({
headers: {
'retry-after': '2700',
'x-sentry-rate-limits': '60::organization, 2700::organization',
},
statusCode: RATE_LIMIT,
}),
);
});
@@ -329,6 +323,7 @@ describe('makeNewHttpsTransport()', () => {

await expect(executorResult).resolves.toEqual(
expect.objectContaining({
statusCode: SUCCESS,
headers: {
'retry-after': null,
'x-sentry-rate-limits': null,
@@ -356,6 +351,7 @@ describe('makeNewHttpsTransport()', () => {

await expect(executorResult).resolves.toEqual(
expect.objectContaining({
statusCode: SUCCESS,
headers: {
'retry-after': '2700',
'x-sentry-rate-limits': '60::organization, 2700::organization',
@@ -383,6 +379,7 @@ describe('makeNewHttpsTransport()', () => {

await expect(executorResult).resolves.toEqual(
expect.objectContaining({
statusCode: RATE_LIMIT,
headers: {
'retry-after': '2700',
'x-sentry-rate-limits': '60::organization, 2700::organization',