• <legend id='bLSEt'><style id='bLSEt'><dir id='bLSEt'><q id='bLSEt'></q></dir></style></legend>
  • <small id='bLSEt'></small><noframes id='bLSEt'>

    <tfoot id='bLSEt'></tfoot>

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

        如何使用 Axios 发布查询参数?

        How to post query parameters with Axios?(如何使用 Axios 发布查询参数?)

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

                <tbody id='MZxB2'></tbody>

            • <tfoot id='MZxB2'></tfoot>
                <bdo id='MZxB2'></bdo><ul id='MZxB2'></ul>
              • <small id='MZxB2'></small><noframes id='MZxB2'>

                <i id='MZxB2'><tr id='MZxB2'><dt id='MZxB2'><q id='MZxB2'><span id='MZxB2'><b id='MZxB2'><form id='MZxB2'><ins id='MZxB2'></ins><ul id='MZxB2'></ul><sub id='MZxB2'></sub></form><legend id='MZxB2'></legend><bdo id='MZxB2'><pre id='MZxB2'><center id='MZxB2'></center></pre></bdo></b><th id='MZxB2'></th></span></q></dt></tr></i><div id='MZxB2'><tfoot id='MZxB2'></tfoot><dl id='MZxB2'><fieldset id='MZxB2'></fieldset></dl></div>
                • 本文介绍了如何使用 Axios 发布查询参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试使用一些查询参数在 API 上发帖.当我尝试通过将邮件和名字作为查询参数传递时,这适用于 PostMan/Insomnia :

                  I am trying to post on an API with some query params. This is working on PostMan / Insomnia when I am trying to by passing mail and firstname as query parameters :

                   http://localhost:8000/api/mails/users/sendVerificationMail?mail=lol%40lol.com&firstname=myFirstName
                  

                  但是,当我尝试使用 React Native 应用程序执行此操作时,出现 400 错误(查询参数无效).

                  However, when I am trying to do it with my react native app, I got a 400 error (Invalid Query Parameters).

                  这是post方法:

                  .post(`/mails/users/sendVerificationMail`, {
                    mail,
                    firstname
                  })
                  .then(response => response.status)
                  .catch(err => console.warn(err));
                  

                  (我的邮件和名字在控制台中记录如下:lol@lol.commyFirstName).

                  (my mail and firstname are console.logged as follow: lol@lol.com and myFirstName).

                  所以我不知道如何在我的请求中使用 Axios 传递查询参数(因为现在,它正在传递 data: { mail: "lol@lol.com", firstname: "myFirstName" }.

                  So I don't know how to pass Query Parameters with Axios in my request (because right now, it's passing data: { mail: "lol@lol.com", firstname: "myFirstName" }.

                  推荐答案

                  axios 签名为 axios.post(url[, data[, config]]).所以你想在第三个参数中发送 params 对象:

                  axios signature for post is axios.post(url[, data[, config]]). So you want to send params object within the third argument:

                  .post(`/mails/users/sendVerificationMail`, null, { params: {
                    mail,
                    firstname
                  }})
                  .then(response => response.status)
                  .catch(err => console.warn(err));
                  

                  这将发布一个带有两个查询参数的空主体:

                  This will POST an empty body with the two query params:

                  发布http://localhost:8000/api/mails/users/sendVerificationMail?mail=lol%40lol.com&firstname=myFirstName

                  这篇关于如何使用 Axios 发布查询参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
                  What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                  MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
                  MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
                  Why Mysql#39;s Group By and Oracle#39;s Group by behaviours are different(为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同)
                  MySQL GROUP BY DateTime +/- 3 seconds(MySQL GROUP BY DateTime +/- 3 秒)
                  • <tfoot id='1ip2W'></tfoot>

                    <small id='1ip2W'></small><noframes id='1ip2W'>

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

                            <bdo id='1ip2W'></bdo><ul id='1ip2W'></ul>