javascript - Encode a string for sending with HTTP request? -


i on javascript/node.js , when i'm making http request query parameter:

?key="https://me.yahoo.com/a/xt4hq7qyssa8hymjkv8mevqqkghq_1jwvas-#a6e6f" 

i error because shops of after:

?key="https://me.yahoo.com/a/xt4hq7qyssa8hymjkv8mevqqkghq_1jwvas- 

i wonder how can encode string doesn't chop off?

i'm assuming hash (#) @ end of url part of query argument. problem node.js treating hash of overall url, plays no role in http requests. thus, you'll need encode query string.

a structured api function querystring.stringify best.

var query = querystring.stringify({   key: '"https://me.yahoo.com/a/xt4hq7qyssa8hymjkv8mevqqkghq_1jwvas-#a6e6f"' }); 

Comments

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -