-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemos.patch.js
More file actions
91 lines (80 loc) · 2.37 KB
/
Copy pathdemos.patch.js
File metadata and controls
91 lines (80 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/**
*
* Package:
* Author: Ganesh B
* Description:
* Install: npm i request-apis --save
* Github: https://github.com/ganeshkbhat/apis-request
* npmjs Link: https://www.npmjs.com/package/request-apis
* File: test-.js
* Test for File: index.js
* File Description:
*
*/
'use strict';
const req = require("../index.js");
let data = {
"id": 0,
"category": {
"id": 0,
"name": "string"
},
"name": "doggie",
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "available"
}
let r = req._patchRequest({ hostname: "petstore.swagger.io", port: 443, path: "/v2/pet/idhere", method: "PATCH", headers: { "content-type": "application/json", "accept": "application/json" } }, data, "https");
r.then(rs => console.log(JSON.stringify(rs), rs.toString()))
data.name = "newstore";
let rc = req._patchRequest({ hostname: "petstore.swagger.io", port: 443, path: "/v2/pet/idhere", method: "PATCH", headers: { "content-type": "application/json", "accept": "application/json" } }, data, "https");
rc.then(rs => console.log(JSON.stringify(rs), rs.toString()))
let dataXML = `<?xml version="1.0" encoding="UTF-8"?>
<Pet>
<id>0</id>
<Category>
<id>0</id>
<name>string</name>
</Category>
<name>newstore</name>
<photoUrls>
<photoUrl>string</photoUrl>
</photoUrls>
<tags>
<Tag>
<id>0</id>
<name>string</name>
</Tag>
</tags>
<status>available</status>
</Pet>`
let rxml = req._patchRequest({ hostname: "petstore.swagger.io", port: 443, path: "/v2/pet/idhere", method: "PATCH", headers: { "content-type": "application/xml", "accept": "application/xml" } }, dataXML, "https");
rxml.then(rs => console.log(JSON.stringify(rs), rs.toString()))
dataXML = `<?xml version="1.0" encoding="UTF-8"?>
<Pet>
<id>0</id>
<Category>
<id>0</id>
<name>string</name>
</Category>
<name>newstore</name>
<photoUrls>
<photoUrl>string</photoUrl>
</photoUrls>
<tags>
<Tag>
<id>0</id>
<name>string</name>
</Tag>
</tags>
<status>available</status>
</Pet>`
let rcxml = req._patchRequest({ hostname: "petstore.swagger.io", port: 443, path: "/v2/pet/idhere", method: "PATCH", headers: { "content-type": "application/xml", "accept": "application/xml" } }, dataXML, "https");
rcxml.then(rs => console.log(JSON.stringify(rs), rs.toString()))