Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yPhil
feedrat
Commits
74733cb2
Commit
74733cb2
authored
Feb 04, 2021
by
yPhil
Browse files
Request syntax response tests
parent
c3ddcc8f
Changes
1
Hide whitespace changes
Inline
Side-by-side
feedrat.js
View file @
74733cb2
...
...
@@ -81,10 +81,22 @@ module.exports = function(url, searchPrefix, callback) {
};
function
does_it_render
(
url
,
callback
)
{
// request
// .get(url)
// .on('response', function(response) {
// console.log(response.statusCode) // 200
// console.log(response.headers['content-type']) // 'image/png'
// })
// .on('error', function(err) { // <------- add this
// console.log(err)
// });
request
(
url
,
function
(
err
,
res
,
body
)
{
if
(
err
||
!
body
||
body
===
''
||
!
res
.
headers
[
'
content-type
'
].
includes
(
'
xml
'
))
{
return
callback
(
err
);
}
callback
(
null
,
res
.
statusCode
<
300
&&
res
.
headers
[
'
content-type
'
].
includes
(
'
xml
'
));
});
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment