之前发生了这样一件事,由于是用的postman发送的消息,消息体有几种常用构造方式:none,form-data,x-www-form-urlencoded
有一些构造方式通过getParameter方法是获取不到数据的,接下来让我们一起看一下这个问题
首先我对两种构造方式进行了抓包,看到他们发出去的请求
首先时form-data格式下的Get,Post方式
GET http://localhost:8080/TestHttp/HelloWord HTTP/1.1
Content-Type: multipart/form-data; boundary=--------------------------130695699130126180335395
User-Agent: PostmanRuntime/7.15.0
Accept: */*
Cache-Control: no-cache
Postman-Token: 255c0f6d-0296-4095-af08-3a0bc1e1f756
Host: localhost:8080
accept-encoding: gzip, deflate
content-length: 281
Connection: keep-alive
----------------------------130695699130126180335395
Content-Disposition: form-data; name="username"
admin
----------------------------130695699130126180335395
Content-Disposition: form-data; name="password"
123456
----------------------------130695699130126180335395--
POST http://localhost:8080/TestHttp/HelloWord HTTP/1.1
Content-Type: multipart/form-d