我正在尝试发送此请求:
WebClient.Builder builder = WebClient.builder();
WebClient client = builder.build();
client.post().uri(response.getMethod_result().getAcsUrl())
.header("PaReq", "eJxdUdtu6jAQ/BXEB8R2uCRBiyUKB")
.accept(MediaType.TEXT_PLAIN)
.contentType(MediaType.TEXT_PLAIN)
.retrieve()
.bodyToMono(String.class).block();
我想发送令牌作为标头参数。但是我得到了错误:
但是我得到了错误:
20:21:14.129 [reactor-http-nio-4] WARN r.n.http.client.HttpClientConnect - [id: 0x92efcc15, L:/192.168.1.133:61444 - R:securecode.lisa.mastercard.com/216.119.218.240:443] The connection observed an error
java.lang.IllegalArgumentException: only ' ' and '\t' are allowed after '\n': eJxdUdtu6jAQ/BXEB8R2uCRBiyUKB5UHUERBKn1zzR6I2lxwkob067smSWn7YGlntDuenYXd2SAu
nlCXBiWsMc/VCXvRcdrno0EQ8L6EcLbFi4QPNHmUJlI43HGBdZBmjD6rpJCg9OVhtZHu2HfHAlgL
IUazWkhXeJzzIU02GBIVo8RuOlQ1sBsFOi2TwtTSH3JgHYDSvMtzUWT5hLGqqhyM28lM1Y5OYwbM
tgC7+wlLW+UkeY2Ocr2YVX/fZrf+3OxWU2C2A46qQOlyEfCAez3hTVwxccnEjQcVWy/y33474A4n
uiUgs//MGjCgJYH9ZICiNZjoWgaeTwt1CPCapQlSB2XyXQO7u54/2kx1QWn5h+CS/Vc4F+FoWSxf
94FfvWSH55N6I/Ntk1WMKCvaoJG0AJiVYe0RKZ3bhan6dfkvyA6s2Q==
at io.netty.handler.codec.http.DefaultHttpHeaders$HeaderValueConverterAndValidator.validateValueChar(DefaultHttpHeaders.java:492)
您知道我该如何解决吗?发送请求后,应该返回网页
答案 0 :(得分:0)
您应检查标头值中是否不包含“ \ n”。
我想您的代码如下:
.header("PaReq", "eJxdUdtu6jAQ/BXEB8R2uCRBiyUKB5UHUERBKn1zzR6I2lxwkob067smSWn7YGlntDuenYXd2SAu\n" +
"nlCXBiWsMc/VCXvRcdrno0EQ8L6EcLbFi4QPNHmUJlI43HGBdZBmjD6rpJCg9OVhtZHu2HfHAlgL\n" +
"IUazWkhXeJzzIU02GBIVo8RuOlQ1sBsFOi2TwtTSH3JgHYDSvMtzUWT5hLGqqhyM28lM1Y5OYwbM\n" +
"tgC7+wlLW+UkeY2Ocr2YVX/fZrf+3OxWU2C2A46qQOlyEfCAez3hTVwxccnEjQcVWy/y33474A4n\n" +
"uiUgs//MGjCgJYH9ZICiNZjoWgaeTwt1CPCapQlSB2XyXQO7u54/2kx1QWn5h+CS/Vc4F+FoWSxf");
因此删除所有“ \ n”。
希望对您有帮助。