-
Notifications
You must be signed in to change notification settings - Fork 10
/
api-data.txt
134 lines (131 loc) · 6.88 KB
/
api-data.txt
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
window.addEventListener('message', e => {
if (e.data.source === 'content') {
console.log('this is a test', e);
}
})
window.postMessage({
source: 'external',
payload: {
type: 'settings',
data: { active: true }
}
}, '*');
window.postMessage({
source: 'external',
payload: {
type: 'upsert',
context: { domain: 'localhost:8000' },
data: {
"requests": [
{
"id": "zborm2g4g4",
"lastHit": 1648411105428,
"method": "GET",
"mocks": {
"tzrvoyctex": {
"id": "tzrvoyctex",
"label": "",
"statusCode": 200
}
},
"requestType": "FETCH",
"type": "request",
"url": "/users",
"version": "3.3.5"
}
],
"responses": [
{
"createdOn": "2022-03-27T19:57:39.013Z",
"delay": 0,
"domains": [
"localhost:8000"
],
"headers": {
"content-length": "341",
"content-type": "application/json; charset=utf-8",
"date": "Sun, 27 Mar 2022 19:57:39 GMT",
"etag": "W/\"155-ijaYXYvIv0CinUuvNl4UaYXfxEQ\"",
"x-powered-by": "Express"
},
"headersMock": {
"content-length": "341",
"content-type": "application/json; charset=utf-8",
"date": "Sun, 27 Mar 2022 19:57:39 GMT",
"etag": "W/\"155-ijaYXYvIv0CinUuvNl4UaYXfxEQ\"",
"x-powered-by": "Express"
},
"id": "tzrvoyctex",
"jsCode": "/* This is where OhMyMock creates responses.\nInside this sandbox you have access to the following data:\n * 'mock' - object with a cached response, header and status code\n * 'request' - details of the ongoing request\n * Feel free to use fetch or XMLHttpRequest, but make sure to\n return a PROMISE in that case!!\n\n- Synchronous example:\n const response = JSON.parse(mock.response);\n response[1].name = \"Sync example\";\n mock.response = JSON.stringify(response);\n return mock;\n\n- Asynchronous example:\n\n const response = await fetch(\"/users\");\n const data = await response.json();\n data[1].name = \"From custom code\";\n mock.response = JSON.stringify(r);\n\n // No need to return a Promise here, \"await\" takes care o this!\n return mock;\n*/\n\nreturn mock;\n",
"label": "",
"modifiedOn": null,
"origin": "local",
"response": "{\n \"1\": {\n \"name\": \"bar Foo\",\n \"password\": \"password1\",\n \"profession\": \"king\",\n \"id\": 1\n },\n \"2\": {\n \"name\": \"rob kendal\",\n \"password\": \"password3\",\n \"profession\": \"code fiddler\",\n \"id\": 2\n },\n \"3\": {\n \"name\": \"teresa may\",\n \"password\": \"password2\",\n \"profession\": \"brexit destroyer\",\n \"id\": 6\n }\n}\n",
"responseMock": "{\n \"1\": {\n \"name\": \"bar Foo 1\",\n \"password\": \"password1\",\n \"profession\": \"king\",\n \"id\": 1\n },\n \"2\": {\n \"name\": \"rob kendal\",\n \"password\": \"password3\",\n \"profession\": \"code fiddler\",\n \"id\": 2\n },\n \"3\": {\n \"name\": \"teresa may\",\n \"password\": \"password2\",\n \"profession\": \"brexit destroyer\",\n \"id\": 6\n }\n}",
"rules": [],
"statusCode": 200,
"type": "response",
"version": "3.3.6-beta.110"
}
],
"version": "3.3.5"
}
}
}, '*');
// ----
window.OhMyMocks.api.upsert(
{
"requests": [
{
"id": "zborm2g4g4",
"lastHit": 1648411105428,
"method": "GET",
"mocks": {
"tzrvoyctex": {
"id": "tzrvoyctex",
"label": "",
"statusCode": 200
}
},
"requestType": "XHR",
"type": "request",
"url": "/users",
"version": "3.3.5"
}
],
"responses": [
{
"createdOn": "2022-03-27T19:57:39.013Z",
"delay": 0,
"domains": [
"localhost:8000"
],
"headers": {
"content-length": "341",
"content-type": "application/json; charset=utf-8",
"date": "Sun, 27 Mar 2022 19:57:39 GMT",
"etag": "W/\"155-ijaYXYvIv0CinUuvNl4UaYXfxEQ\"",
"x-powered-by": "Express"
},
"headersMock": {
"content-length": "341",
"content-type": "application/json; charset=utf-8",
"date": "Sun, 27 Mar 2022 19:57:39 GMT",
"etag": "W/\"155-ijaYXYvIv0CinUuvNl4UaYXfxEQ\"",
"x-powered-by": "Express"
},
"id": "tzrvoyctex",
"jsCode": "/* This is where OhMyMock creates responses.\nInside this sandbox you have access to the following data:\n * 'mock' - object with a cached response, header and status code\n * 'request' - details of the ongoing request\n * Feel free to use fetch or XMLHttpRequest, but make sure to\n return a PROMISE in that case!!\n\n- Synchronous example:\n const response = JSON.parse(mock.response);\n response[1].name = \"Sync example\";\n mock.response = JSON.stringify(response);\n return mock;\n\n- Asynchronous example:\n\n const response = await fetch(\"/users\");\n const data = await response.json();\n data[1].name = \"From custom code\";\n mock.response = JSON.stringify(r);\n\n // No need to return a Promise here, \"await\" takes care o this!\n return mock;\n*/\n\nreturn mock;\n",
"label": "",
"modifiedOn": null,
"origin": "local",
"response": "{\n \"1\": {\n \"name\": \"bar Foo\",\n \"password\": \"password1\",\n \"profession\": \"king\",\n \"id\": 1\n },\n \"2\": {\n \"name\": \"rob kendal\",\n \"password\": \"password3\",\n \"profession\": \"code fiddler\",\n \"id\": 2\n },\n \"3\": {\n \"name\": \"teresa may\",\n \"password\": \"password2\",\n \"profession\": \"brexit destroyer\",\n \"id\": 6\n }\n}\n",
"responseMock": "{\n \"1\": {\n \"name\": \"bar Foo 1\",\n \"password\": \"password1\",\n \"profession\": \"king\",\n \"id\": 1\n },\n \"2\": {\n \"name\": \"rob kendal\",\n \"password\": \"password3\",\n \"profession\": \"code fiddler\",\n \"id\": 2\n },\n \"3\": {\n \"name\": \"teresa may\",\n \"password\": \"password2\",\n \"profession\": \"brexit destroyer\",\n \"id\": 6\n }\n}",
"rules": [],
"statusCode": 200,
"type": "response",
"version": "3.3.6-beta.110"
}
],
"version": "3.3.5"
}, e => { debugger });