token传参问题 (Bearer后面需要加一个空格)

 token传参问题,反复检查很多地方都没有问题,最终问题是Bearer后面没有加空格

header: { authorization: 'Bearer ' + that.token },

 

	uni.request({
								url: that.$serverUrl + '/treatment/addTreat',
								data: JSON.stringify(formData),
								contentType: 'application/json;charset=UTF-8',
								header: { authorization: 'Bearer ' + that.token },
								method: 'POST',
								success(result) {
									//console.log(that.token);
									if (result.data.desc == '提交成功') {
										uni.showToast({
											title: '提交成功',
											icon: 'none',
											duration: 10000
										});
										uni.navigateBack({
											delta: 1
										});
									} else {
										uni.showToast({
											title: '提交失败'
										});
										uni.navigateBack();
									}
								},
								fail(err) {
									console.log(err);
								}
							});

 

你可能感兴趣的:(vue)