grape-api - Grape API 正在从字符串中删除“+”(替换为空格)
问题描述
我有一个葡萄 API,作为 POST 请求的一部分,我传递了一个包含“+”的字符串(它是一个电话号码)。葡萄似乎正在删除+
并用空白替换它。
module V1
class CustomerDetails < Grape::API
before do
error!("Unauthorized", 401) unless authenticated?
end
resource :customer_details do
desc 'Update customer number'
post anchor: false do
params do
requires :customer_id, type: String
requires :customer_number, type: String
end
# Current behaviour:
# params[:customer_number] here will be ' 441920765847'
# Expected behaviour:
# params[:customer_number] here will be '+441920765847'
end
end
end
end
我希望使用邮递员发出 http POST 请求,参数customer_number
带有值+441920765847
并且它不会丢失+
(即不显示为441920765847
.
解决方案
解决了!这是邮递员删除它,因为我是在参数(网址字符串)中发送它而不是在正文中
推荐阅读
- javascript - How do I open a page outside of the iframe but within the same tab?
- ruby - How to write a while loop properly
- r - R:无法将 .rda 文件加载到 R Studio -> 无法打开压缩文件“ESL.mixture.rda”,可能的原因“没有这样的文件或目录”
- routing - Ionic 4 路由不起作用 url 更改但视图没有出现
- c# - 如何发送超过 70 个字符的短信
- bash - Perl 在 Shell 脚本中搜索和替换
- php - IPS4 php获取当前成员的ID
- javascript - '{}' 类型的参数不能分配给 Angular 8 中的类型参数
- python-3.x - 如何计算两行特定列之间的最大值
- python - 像素着色器中的 Mandelbrot