WeChat applet request 400 problem solution, Applet request

Source: Internet
Author: User

A 400 error occurs in the small program request.

Solution to 400 Error in small program request

I recently followed the demo to learn the applet. When I made a network request, I encountered 400 errors. The Code is as follows:

Wx. request ({url: "https://api.douban.com/v2/movie/top250", data :{}, header: {"Content-Type": "application/json"}, success: function (res) {console. log (res. data); var data = res. data; currentPage. setData ({list: data. subjects })},});

In the following situations, I was also scared (the browser can also take data ):

It turns out that after the development tool upgrade, the Content-type method of the Request header has changed (the development tool Version I am currently using is 0.14) and needs to be changed

Header: {"Content-Type": "json "},

In this way, you can request data normally.

Thank you for reading this article. I hope it will help you. Thank you for your support for this site!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.