From a8ead39f70775e48255498bffba50406f97ce96a Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Fri, 16 Jun 2017 10:08:42 -0700 Subject: [PATCH 1/2] Fix weak type errors in request tests --- .../request-promise-native/request-promise-native-tests.ts | 4 ++-- types/request-promise/request-promise-tests.ts | 5 +++-- types/request/request-tests.ts | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/types/request-promise-native/request-promise-native-tests.ts b/types/request-promise-native/request-promise-native-tests.ts index d553ab3dcc..e4078ce2e9 100644 --- a/types/request-promise-native/request-promise-native-tests.ts +++ b/types/request-promise-native/request-promise-native-tests.ts @@ -186,7 +186,7 @@ rpn({ uri: 'http://service.com/upload', multipart: [ { - 'content-type': 'application/json', + headers: { 'content-type': 'application/json' }, body: JSON.stringify({ foo: 'bar', _attachments: { 'message.txt': { follows: true, length: 18, content_type: 'text/plain' } } }) }, { body: 'I am an attachment' }, @@ -410,7 +410,7 @@ rpn( uri: 'http://mikeal.iriscouch.com/testjs/' + rand, multipart: [{ - 'content-type': 'application/json', + headers: { 'content-type': 'application/json' }, body: JSON.stringify({ foo: 'bar', _attachments: { 'message.txt': { follows: true, length: 18, content_type: 'text/plain' } } }) }, { body: 'I am an attachment' } diff --git a/types/request-promise/request-promise-tests.ts b/types/request-promise/request-promise-tests.ts index d164c95c17..a98ffdb5f8 100644 --- a/types/request-promise/request-promise-tests.ts +++ b/types/request-promise/request-promise-tests.ts @@ -216,7 +216,7 @@ request({ uri: 'http://service.com/upload', multipart: [ { - 'content-type': 'application/json', + headers: { 'content-type': 'application/json' }, body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) }, { body: 'I am an attachment' }, @@ -442,7 +442,8 @@ var rand = Math.floor(Math.random()*100000000).toString(); { method: 'PUT' , uri: 'http://mikeal.iriscouch.com/testjs/' + rand , multipart: - [ { 'content-type': 'application/json' + [ { + headers: { 'content-type': 'application/json' } , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) } , { body: 'I am an attachment' } diff --git a/types/request/request-tests.ts b/types/request/request-tests.ts index 7e7a8a5722..2ee98bdf1d 100644 --- a/types/request/request-tests.ts +++ b/types/request/request-tests.ts @@ -363,7 +363,7 @@ request({ uri: 'http://service.com/upload', multipart: [ { - 'content-type': 'application/json', + headers: { 'content-type': 'application/json' }, body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) }, { body: 'I am an attachment' }, @@ -600,8 +600,8 @@ var rand = Math.floor(Math.random()*100000000).toString(); { method: 'PUT' , uri: 'http://mikeal.iriscouch.com/testjs/' + rand , multipart: - [ { 'content-type': 'application/json' - , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) + [ { headers: { 'content-type': 'application/json' } + , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) } , { body: 'I am an attachment' } ] From 1d4d00cfcffef8fb3a4a796e7dfaa090849248a4 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Fri, 16 Jun 2017 10:19:12 -0700 Subject: [PATCH 2/2] Fix incomplete merge --- .../request-promise/request-promise-tests.ts | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/types/request-promise/request-promise-tests.ts b/types/request-promise/request-promise-tests.ts index 9b709fb93f..4aee91370b 100644 --- a/types/request-promise/request-promise-tests.ts +++ b/types/request-promise/request-promise-tests.ts @@ -427,32 +427,7 @@ request.get('http://10.255.255.1', {timeout: 1500}, err => { process.exit(0); }); -<<<<<<< HEAD -var rand = Math.floor(Math.random()*100000000).toString(); - request( - { method: 'PUT' - , uri: 'http://mikeal.iriscouch.com/testjs/' + rand - , multipart: - [ { - headers: { 'content-type': 'application/json' } - , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) - } - , { body: 'I am an attachment' } - ] - } - , function (error, response, body) { - if(response.statusCode == 201){ - console.log('document saved as: http://mikeal.iriscouch.com/testjs/'+ rand) - } else { - console.log('error: '+ response.statusCode) - console.log(body) - } - } - ); - -======= const rand = Math.floor(Math.random() * 100000000).toString(); ->>>>>>> master request( { method: 'PUT',