fix: replace upload fixture image.png with a smaller upload.txt (#563)

This commit is contained in:
shadyzoz
2020-06-17 20:58:32 +08:00
committed by xiaofeng.mxf
parent 4fb20d28ce
commit 72333fdb55
7 changed files with 517 additions and 10 deletions

View File

@@ -34,11 +34,11 @@ describe('Rule beforeDealHttpsRequest', () => {
});
it('Should replace the https request body', async () => {
const url = 'https://httpbin.org/put';
const payloadStream = fs.createReadStream(path.resolve(__dirname, '../fixtures/image.png'));
const payloadStream = fs.createReadStream(path.resolve(__dirname, '../fixtures/upload.txt'));
const postHeaders = {
anyproxy_header: 'header_value',
};
await basicProxyRequest(proxyHost, 'PUT', url, postHeaders, {}, payloadStream).then((result) => {
const proxyRes = result.response;
const body = JSON.parse(result.body);

View File

@@ -58,11 +58,11 @@ describe('Rule replaceRequestData', () => {
it('should replace the request data in proxy if the assertion is true', async () => {
const url = 'http://httpbin.org/post';
const payloadStream = fs.createReadStream(path.resolve(__dirname, '../fixtures/image.png'));
const payloadStream = fs.createReadStream(path.resolve(__dirname, '../fixtures/upload.txt'));
const postHeaders = {
anyproxy_header: 'header_value',
};
await basicProxyRequest(proxyHost, 'POST', url, postHeaders, {}, payloadStream).then((result) => {
const proxyRes = result.response;
const body = JSON.parse(result.body);
@@ -73,7 +73,7 @@ describe('Rule replaceRequestData', () => {
});
it('should respond content specified in rule', async () => {
const url = 'http://httpbin.org/status/302';
const url = 'http://httpbin.org/status/302';
await basicProxyRequest(proxyHost, 'GET', url).then((result) => {
const proxyRes = result.response;
const body = result.body;
@@ -84,7 +84,7 @@ describe('Rule replaceRequestData', () => {
});
it('should replace protocol and url', async () => {
const url = 'http://domain_not_exists.anyproxy.io/should_be_replaced';
const url = 'http://domain_not_exists.anyproxy.io/should_be_replaced';
await basicProxyRequest(proxyHost, 'GET', url).then((result) => {
const proxyRes = result.response;
expect(proxyRes.statusCode).toBe(302);