Skip to content

Commit

Permalink
fix(repeater): rename whitelistMimes to allowedMimes (#113)
Browse files Browse the repository at this point in the history
closes #112
  • Loading branch information
derevnjuk authored Jun 8, 2022
1 parent bc05852 commit f3a2459
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions packages/repeater/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ The default `requestRunnerOptions` is as follows:
timeout: 30000,
maxContentLength: 100,
reuseConnection: false,
whitelistMimes: [
allowedMimes: [
'text/html',
'text/plain',
'text/css',
Expand All @@ -87,7 +87,7 @@ export interface RequestRunnerOptions {
timeout?: number;
proxyUrl?: string;
headers?: Record<string, string | string[]>;
whitelistMimes?: string[];
allowedMimes?: string[];
maxContentLength?: number;
reuseConnection?: boolean;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/repeater/src/lib/RepeaterFactory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ describe('RepeaterFactory', () => {
const requestRunnerOptions = {
timeout: 10000,
maxContentLength: 200,
whitelistMimes: ['text/html']
allowedMimes: ['text/html']
};

await factory.createRepeater({
Expand Down Expand Up @@ -169,7 +169,7 @@ describe('RepeaterFactory', () => {
timeout: 30000,
maxContentLength: 100,
reuseConnection: false,
whitelistMimes: [
allowedMimes: [
'text/html',
'text/plain',
'text/css',
Expand Down
2 changes: 1 addition & 1 deletion packages/repeater/src/lib/RepeaterFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class RepeaterFactory {
timeout: 30000,
maxContentLength: 100,
reuseConnection: false,
whitelistMimes: [
allowedMimes: [
'text/html',
'text/plain',
'text/css',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export interface RequestRunnerOptions {
timeout?: number;
proxyUrl?: string;
headers?: Record<string, string | string[]>;
whitelistMimes?: string[];
allowedMimes?: string[];
maxContentLength?: number;
reuseConnection?: boolean;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ describe('HttpRequestRunner', () => {
expect(response.body).toEqual(bigBody.slice(0, 1024));
});

it('should not truncate response body if it is in whitelisted mime types', async () => {
it('should not truncate response body if it is in allowed mime types', async () => {
const runner = setupRunner({
maxContentLength: 1,
whitelistMimes: ['application/x-custom']
allowedMimes: ['application/x-custom']
});
const { request, requestOptions } = createRequest();
const bigBody = 'x'.repeat(1025);
Expand All @@ -137,10 +137,10 @@ describe('HttpRequestRunner', () => {
expect(response.body).toEqual(bigBody);
});

it('should not truncate response body if whitelisted mime type starts with actual one', async () => {
it('should not truncate response body if allowed mime type starts with actual one', async () => {
const runner = setupRunner({
maxContentLength: 1,
whitelistMimes: ['application/x-custom']
allowedMimes: ['application/x-custom']
});
const { request, requestOptions } = createRequest();
const bigBody = 'x'.repeat(1025);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export class HttpRequestRunner implements RequestRunner {
const type = this.parseContentType(res);
const maxBodySize = this.maxContentLength * 1024;

const requiresTruncating = !this.options.whitelistMimes?.some(
const requiresTruncating = !this.options.allowedMimes?.some(
(mime: string) => type.startsWith(mime)
);

Expand Down

0 comments on commit f3a2459

Please sign in to comment.