Skip to content

nvue下纯native渲染post with application/x-www-form-urlencoded 有问题 #1100

Closed
@wakaryry

Description

  • 2.4.2/2.4.4 alpha,其它未测试;
  • nvue页面;
  • uni-app模式;
  • native渲染;

content-type 为 application/x-www-form-urlencoded 时,data 数据 打包有问题,后台接收数据异常。

b'{\n  "phone" : "17610779055",\n  "type" : "register",\n  "product" : 4\n}'

关掉native开关之后,数据正常:

b'phone=17610779055&type=register&product=4'

测试用例

就一个按钮,点击提交数据到服务器。没有任何的依赖。

<template>
	<view>
		<view style="height: 100rpx;"></view>
		<button @tap="toUni">uni request</button>
	</view>
</template>

<script>
	export default {
		methods: {
			toUni() {
				uni.request({
					header: {'Content-Type': 'application/x-www-form-urlencoded'},
					data: {
						phone: '17610771234',
						type: 'register',
						product: 4
					},
					method: 'POST',
					url: 'your url',
					success(res) {
						console.log("请求发送成功")
						console.log(res)
					},
					fail(err) {
						console.log("请求发送失败")
						console.log(err)
					}
				})
			}
		}
	}
</script>

<style>

</style>

希望确认一下这个问题,因为我 nvue 页面,关闭掉 native 之后,白屏,没有任何报错。打开 native 之后,数据打包又存在问题。

谢谢。

这个问题花费了差不多一个多星期才知道是什么地方引起的。

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions