Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F4503341
fetch.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
727 B
Referenced Files
None
Subscribers
None
fetch.js
View Options
const
fetchJson
=
(
url
,
options
)
=>
fetch
(
url
,
options
).
then
(
r
=>
r
.
json
());
const
test_get
=
async
()
=>
{
const
{
ip
}
=
await
fetchJson
(
'https://ifconfig.co/json'
);
console
.
log
(
ip
);
};
const
test_json
=
async
()
=>
{
const
test
=
await
fetchJson
(
'https://themackabu.dev/test.json'
);
console
.
log
(
test
);
};
const
test_post
=
async
()
=>
{
const
{
json
,
headers
}
=
await
fetchJson
(
'https://httpbingo.org/post'
,
{
method
:
'POST'
,
body
:
JSON
.
stringify
({
runtime
:
'ant'
}),
headers
:
{
'Content-Type'
:
'application/json'
,
'User-Agent'
:
'ant/alpha (ant)'
}
});
console
.
log
(
`
${
JSON
.
stringify
(
json
)
}
\n
${
JSON
.
stringify
(
headers
)
}
`
);
};
Promise
.
all
([
test_get
(),
test_post
(),
test_json
()]);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, May 3, 9:26 AM (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
518034
Default Alt Text
fetch.js (727 B)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment