goferito / node-bing-api

Node.js module for the Bing Search API (Cognitive Services)
MIT License
56 stars 28 forks source link

fixes http 400 bad request errors #39

Closed jritsema closed 7 years ago

jritsema commented 7 years ago

I noticed that searching on text with special characters seems to cause HTTP 400 errors. For example:

Jakub Czerwiński


Error: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request - Invalid URL</h2>
<hr><p>HTTP Error 400. The request URL is invalid.</p>
</BODY></HTML>

    at Request._callback (/Users/jritsema/code/viddb/node_modules/node-bing-api/lib/bing.js:105:17)
    at Request.self.callback (/Users/jritsema/code/viddb/node_modules/request/request.js:188:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (/Users/jritsema/code/viddb/node_modules/request/request.js:1171:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at IncomingMessage.<anonymous> (/Users/jritsema/code/viddb/node_modules/request/request.js:1091:12)
    at IncomingMessage.g (events.js:291:16)
    at emitNone (events.js:91:20)```
goferito commented 7 years ago

Published. Thank you!