是否可以使用多个分隔符制作正则表达式?例如,我想分割一个字符串,它可以有两种形式:1."string1,string2,string3"或2."string1,string2,string3".我一直试图在javascript中这样做,但到目前为止没有成功.
我正在尝试将这样的对象发送到我的REST API(使用asp net core构建)
{
"firstName":"tersü",
"lastName":"asda"
}
Run Code Online (Sandbox Code Playgroud)
这就是SoapUI的标题形式:
Accept-Encoding: gzip,deflate
Content-Type: application/json:charset=UTF-16
Host: localhost:4004
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Run Code Online (Sandbox Code Playgroud)
但是,我actionContext.ModelState总是无效的,因为它不适用于变音符号.例外情况如下:
无法将索引35处的字节[FC]从指定代码页转换为Unicode
如果有任何帮助,方法签名如下所示:
[ValidateUserData]
public async Task<IActionResult> Update(string userId, [FromBody] UpdateUserRequest updateRequest)
Run Code Online (Sandbox Code Playgroud)
基本上代码永远不会过去
if (!actionContext.ModelState.IsValid)
{
actionContext.Result = new BadRequestObjectResult(actionContext.ModelState);
}
Run Code Online (Sandbox Code Playgroud)
在[ValidateUserData]属性内
我在这里错过了什么?
我一直在尝试iron-ajax向服务器发送一个简单的帖子,但在飞行前调用时它一直失败。对于我的一生,我无法弄清楚发生了什么,服务器上的所有 CORS 标头似乎都是正确的。
Response headers
Access-Control-Allow-Credentials:true
Access-Control-Allow-Headers:Content-Type
Access-Control-Allow-Methods:GET, POST, PUT, OPTIONS
Access-Control-Allow-Origin:*
cache-control:must-revalidate, private, no-cache, no-store, max-age=0
Connection:Keep-Alive
Content-Encoding:gzip
Content-Length:138
Content-Type:text/html
Run Code Online (Sandbox Code Playgroud)
Request headers
Accept:*/*
Accept-Encoding:gzip, deflate, sdch, br
Accept-Language:en-US,en;q=0.8
Access-Control-Request-Headers:content-type
Access-Control-Request-Method:POST
Cache-Control:no-cache
Connection:keep-alive
Run Code Online (Sandbox Code Playgroud)
该请求确实是从本地主机发出的,但我认为应该*处理这个问题。
控制台中显示的错误是:
OPTIONS https://... 403 (Forbidden)和
XMLHttpRequest cannot load https://.... Response for preflight has invalid HTTP status code 403
Run Code Online (Sandbox Code Playgroud)
任何帮助/建议表示赞赏。
.net ×1
ajax ×1
asp.net ×1
asp.net-core ×1
cors ×1
javascript ×1
polymer ×1
polymer-2.x ×1
preflight ×1
regex ×1
unicode ×1