Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid character in message #26

Open
junaidk opened this issue Apr 20, 2015 · 6 comments
Open

Invalid character in message #26

junaidk opened this issue Apr 20, 2015 · 6 comments
Assignees
Labels

Comments

@junaidk
Copy link

junaidk commented Apr 20, 2015

if there are some invalid characters in request body, a page with stack trace opens like at this url and and It is impossible to go back to Bin view to view other requests.

Opening bin url displays a blank page.

Error: Invalid character (�) in string: { \"ssid\": \"value\", \"message\" : \"msg\", \"time\" : \"9999\" }�[D�[D at index 67
   at XMLStringifier.module.exports.XMLStringifier.assertLegalChar (/app/node_modules/mockbin/node_modules/xmlbuilder/lib/XMLStringifier.js:150:15)
   at XMLStringifier.assertLegalChar (/app/node_modules/mockbin/node_modules/xmlbuilder/lib/XMLStringifier.js:4:59)
   at XMLStringifier.module.exports.XMLStringifier.eleText (/app/node_modules/mockbin/node_modules/xmlbuilder/lib/XMLStringifier.js:27:19)
   at new XMLText (/app/node_modules/mockbin/node_modules/xmlbuilder/lib/XMLText.js:19:35)
   at XMLElement.module.exports.XMLNode.text (/app/node_modules/mockbin/node_modules/xmlbuilder/lib/XMLNode.js:168:15)
   at XMLElement.module.exports.XMLNode.node (/app/node_modules/mockbin/node_modules/xmlbuilder/lib/XMLNode.js:160:15)
   at XMLElement.module.exports.XMLNode.element (/app/node_modules/mockbin/node_modules/xmlbuilder/lib/XMLNode.js:103:28)
   at XMLElement.module.exports.XMLNode.element (/app/node_modules/mockbin/node_modules/xmlbuilder/lib/XMLNode.js:90:30)
   at XMLElement.module.exports.XMLNode.element (/app/node_modules/mockbin/node_modules/xmlbuilder/lib/XMLNode.js:87:25)
   at XMLElement.module.exports.XMLNode.element (/app/node_modules/mockbin/node_modules/xmlbuilder/lib/XMLNode.js:87:25)
@sonicaghi
Copy link
Member

thanks for reporting.

@ahmadnassri
Copy link
Contributor

@junaidk seems like an encoding problem.

can you please paste the body you're using here?

@junaidk
Copy link
Author

junaidk commented Apr 24, 2015

this is the message body { \"ssid\": \"value\", \"message\" : \"msg\", \"time\" : \"9999\" }^[[D^[[D . It has left arraow key chars at the end.
It starts show error page after receiving this message. And there is no way to go back to Bin.

@ahmadnassri ahmadnassri added the bug label Jun 3, 2015
@ahmadnassri ahmadnassri self-assigned this Jun 3, 2015
qwo pushed a commit to stanzhengdev/mockbin that referenced this issue Feb 3, 2016
@qwo
Copy link
Contributor

qwo commented Feb 3, 2016

related to encoding by xmlbuilder in https://github.com/Mashape/mockbin/blob/master/src/middleware/negotiate-content.js#L49

My use case was emojis, althought it was valid json it would throw on this line. According to the module author it can be allowed by adding the {allowSurrogateChars: true} flag to the call. In my case i was handling the instagram api which is sprinkled with emojis and other special characters.

I tested with the string above and it now doesn't throw invalid and renders fine.

oozcitak/xmlbuilder-js#98
oozcitak/xmlbuilder-js#29

Pull request in #40

qwo pushed a commit to stanzhengdev/mockbin that referenced this issue Feb 3, 2016
@ahmadnassri
Copy link
Contributor

thanks @stanzheng

@qwo
Copy link
Contributor

qwo commented Feb 3, 2016

np. great small tool for my prototyping.

this bin view use to crash on render but after applying the fix it works just fine.

http://mockbin-stanzheng.herokuapp.com/bin/02617471-83e0-4243-b5d7-43709197e3ad/log#entry-99

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants