1. <i id='PtmxS'><tr id='PtmxS'><dt id='PtmxS'><q id='PtmxS'><span id='PtmxS'><b id='PtmxS'><form id='PtmxS'><ins id='PtmxS'></ins><ul id='PtmxS'></ul><sub id='PtmxS'></sub></form><legend id='PtmxS'></legend><bdo id='PtmxS'><pre id='PtmxS'><center id='PtmxS'></center></pre></bdo></b><th id='PtmxS'></th></span></q></dt></tr></i><div id='PtmxS'><tfoot id='PtmxS'></tfoot><dl id='PtmxS'><fieldset id='PtmxS'></fieldset></dl></div>

      <small id='PtmxS'></small><noframes id='PtmxS'>

    2. <tfoot id='PtmxS'></tfoot>
        <bdo id='PtmxS'></bdo><ul id='PtmxS'></ul>
      <legend id='PtmxS'><style id='PtmxS'><dir id='PtmxS'><q id='PtmxS'></q></dir></style></legend>

        使用 json (body: raw) POST 数据时总是失败

        时间:2023-10-02

        <small id='Z3XVF'></small><noframes id='Z3XVF'>

        <tfoot id='Z3XVF'></tfoot>

      1. <legend id='Z3XVF'><style id='Z3XVF'><dir id='Z3XVF'><q id='Z3XVF'></q></dir></style></legend>

              <bdo id='Z3XVF'></bdo><ul id='Z3XVF'></ul>
                <tbody id='Z3XVF'></tbody>

                <i id='Z3XVF'><tr id='Z3XVF'><dt id='Z3XVF'><q id='Z3XVF'><span id='Z3XVF'><b id='Z3XVF'><form id='Z3XVF'><ins id='Z3XVF'></ins><ul id='Z3XVF'></ul><sub id='Z3XVF'></sub></form><legend id='Z3XVF'></legend><bdo id='Z3XVF'><pre id='Z3XVF'><center id='Z3XVF'></center></pre></bdo></b><th id='Z3XVF'></th></span></q></dt></tr></i><div id='Z3XVF'><tfoot id='Z3XVF'></tfoot><dl id='Z3XVF'><fieldset id='Z3XVF'></fieldset></dl></div>

                • 本文介绍了使用 json (body: raw) POST 数据时总是失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  I'm have trouble when send data to my server. I'm working with react native & axios ver ^0.16.2

                  let input = {
                    'longitude': -6.3922782,
                    'latitude': 106.8268856,
                    'content': 'uget - uget sampai kaki lemes',
                    'pictures': []
                  }
                  
                    axios({
                      method: 'POST',
                      url,
                      headers: {
                        'Content-Type': 'application/json',
                        'Authorization': this.state.headers.authorization
                      },
                      data: input
                    })                                                                     
                    .then((resultAxios) => {
                      console.log('hasil axios', resultAxios)
                    })
                  

                  and the status result always error 500.

                  If I try send data with postman, everything is fine. In postman, I set

                  headers: {
                    Authorization: ''',
                    Content-Type: application/json
                  }
                  
                  body = raw, JSON
                  

                  How can solve this problem? Thanks :)

                  解决方案

                  I've found that axios have some problem in the processing of json for body try this:

                  let input = 'longitude=-6.3922782&latitude=106.8268856&content="uget - uget sampai kaki lemes"&pictures=[]';
                  
                    axios({
                      method: 'POST',
                      url,
                      headers: {
                        'Content-Type': 'application/json',
                        'Authorization': this.state.headers.authorization
                      },
                      data: input
                    })                                                                     
                    .then((resultAxios) => {
                      console.log('hasil axios', resultAxios)
                    })
                  

                  and the status result always error 500.

                  If I try send data with postman, everything is fine. In postman, I set

                  headers: {
                    Authorization: ''',
                    Content-Type: application/json
                  }
                  
                  body = raw, JSON
                  

                  这篇关于使用 json (body: raw) POST 数据时总是失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在旧浏览器上使用 Fetch 的 ReactJS 下一篇:使用异步/等待返回值意外获取 API

                  相关文章

                • <tfoot id='bSw7u'></tfoot>
                • <small id='bSw7u'></small><noframes id='bSw7u'>

                      <bdo id='bSw7u'></bdo><ul id='bSw7u'></ul>

                  1. <i id='bSw7u'><tr id='bSw7u'><dt id='bSw7u'><q id='bSw7u'><span id='bSw7u'><b id='bSw7u'><form id='bSw7u'><ins id='bSw7u'></ins><ul id='bSw7u'></ul><sub id='bSw7u'></sub></form><legend id='bSw7u'></legend><bdo id='bSw7u'><pre id='bSw7u'><center id='bSw7u'></center></pre></bdo></b><th id='bSw7u'></th></span></q></dt></tr></i><div id='bSw7u'><tfoot id='bSw7u'></tfoot><dl id='bSw7u'><fieldset id='bSw7u'></fieldset></dl></div>
                    <legend id='bSw7u'><style id='bSw7u'><dir id='bSw7u'><q id='bSw7u'></q></dir></style></legend>