javascript - Extra quotes in response.text() -


in react/redux app, make call backend api returns text response. use following line retrieve text. issue i'm seeing code seems put 2 sets of quotes around text receive.

so, api returns hello world! in code below becomes ""hello world!""

my api returning string there set of quotes around text such "hello world!" fine. don't understand why i'm getting 2 sets of quotes.

any idea why?

export const callapi = (request) => {     return (dispatch) => fetch('/api/getsometext', fetchoptionspost(request))         .then((response) => {             if(!response.ok) {                 // request failed                 dispatch(setbadrequest(true))             } else {                 const mytext = response.text() // i'm getting double quotes                 .then((mytext) => dispatch(setmytext(mytext)))             }         }) } 

i think should check , test api using tools postman.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -