Comments (6)
欢迎 PR,我对 uniapp 不太熟
from lyla.
关于基于 lylajs 实现会有以下问题。请教一下是否有解决思路。
关于这两段代码,对于 if (method === 'GET' && body) { } 校验代码段是不是应该放在 adapter 里面自行决定校验?
举个例子,在小程序里面不管是get和post传参都是放在data对象(相当于浏览器端的post 请求的body,可以理解为小程序里面不管什么请求参数都是放在body里面的)。
问题(只在get请求里面存在)
- 在这个get方法里面如果使用query,那么就会遇到小程序里面没有 urlSearchParams 字段的报错。
export function getRepoList(data: { status: string }) {
return lyla<Item>({
method: 'get',
url: '/pet/findByStatus',
// body: data
query: data
})
}
- 如果在get方法使用 json 或者 body 就会遇到下面的错误。因为 options.json 最终会被合并到了 body 里面。body 和 json 对于get 请求是互斥的。
export function getRepoList(data: { status: string }) {
return lyla<Item>({
method: 'get',
url: '/pet/findByStatus',
body: data
// query: data
})
}
from lyla.
这个是我写的一个仓库,里面有复现问题的demo,需要在小程序的环境下可以复现对应的问题
from lyla.
我能理解你说的问题,可以加一个选项来处理
from lyla.
发布了 1.11.0,增加了一个选项叫 allowGetBody,设为 true 的话可以把 get + body 的组合发出去
from lyla.
uniapp 的想要你可以 copy 一个 wx 的包改吧改吧提个 PR
from lyla.
Related Issues (8)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lyla.