v9: Cleanup http interface
See original GitHub issueI run into SyntaxError: Unexpected token < in JSON at position 0
It seems that it may be caused by the same issue as #384 - where http error page was parsed as json.
I want to check is it actually happening but right now I have no idea how to get response code of a failing fetch.
// SyntaxError: Unexpected token < in JSON at position 0
wtf.fetch('https://wiki.openstreetmap.org/wiki/Tag:highway%3Dmotorway').then((doc) => {
//console.log(doc.sentences(0).text())
//console.log(doc.infobox())
//console.log(doc.infobox().json())
})
// works
wtf.fetch('Poland').then((doc) => {
console.log(doc.sentences(0).text())
console.log(doc.infobox())
console.log(doc.infobox().json())
})
/*
// from readme sample
// fails to parse infobox
wtf.fetch('https://muppet.fandom.com/wiki/Miss_Piggy').then((doc) => {
console.log(doc.sentences(0).text())
console.log(doc.infobox())
if(doc.infobox() != undefined) {
console.log(doc.infobox().json())
}
})
*/
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (13 by maintainers)
Top Results From Across the Web
Apache Tomcat 9 Configuration Reference (9.0.70)
Introduction. The HTTP Connector element represents a Connector component that supports the HTTP/1.1 protocol. It enables Catalina to function ...
Read more >Fix list for IBM WebSphere Application Server traditional V9
IBM HTTP Server, Fix List, Detailed list of APARs for IBM HTTP Server ... PH37897, Application edition management feature fails to clean up...
Read more >Scheduled System Jobs v9 - Postgres Enterprise Manager
Server log table cleanup, This job runs periodically to purge old data from the server log table. Every twelve hours, daily starting from...
Read more >TKU Corruption after 9x to 10x Upgrade - Discussion - BMC ...
With "Auto Cleanup" activated, I try to delete the old TKU (v9) but ... the support document "Configuring pattern cleanup" [http://discovery.bmc.com/ ...
Read more >Documentation/v9 - Genesys Documentation
... Mode and control it from a custom agent desktop by using an HTTP REST API, ... This release also includes scripts to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was already looking at this for a bit but christmas got in the way. I already wrote out my usual wall of text and will post it tomorrow.
in addition to allowing users to set custom headers, per @Vacilando , we should set this as a default header - https://www.mediawiki.org/wiki/API:Etiquette#Request_limit recommends to set Accept-Encoding: gzip