Error when unit testing: “Uncaught (in promise) SyntaxError: Unexpected token o in JSON at position 1”

后端 未结 4 1228
太阳男子
太阳男子 2020-12-10 16:58

I\'d like to unit test a service, however, when running the test, I get the following error:

Uncaught (in promise) SyntaxError: Unexpected token o in

4条回答
  •  轮回少年
    2020-12-10 17:38

    No need to parse data.

    Usually when you encounter this error, it means you do not need to parse your data.

    Try using the 'token' directly.

    For sanity, print your data in your console. (you can also Stringify it and print it see what it gives you)

提交回复
热议问题