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
Post a Comment