readChunkedBody

This commit is contained in:
redkale
2024-08-16 12:00:19 +08:00
parent e7ed4ae9bc
commit db0b81b4a0
3 changed files with 144 additions and 11 deletions

View File

@@ -5,6 +5,7 @@
*/
package org.redkale.test.http;
import org.redkale.net.http.RestBody;
import org.redkale.net.http.RestService;
import org.redkale.service.AbstractService;
import org.redkale.util.Utility;
@@ -33,4 +34,9 @@ public class RestSleepService extends AbstractService {
Utility.sleep(500);
return "ok500";
}
public String sleepName(@RestBody String name) {
System.out.println("获取到的名字: " + name);
return "sleep: " + name;
}
}

View File

@@ -63,6 +63,18 @@ public class RestSleepTest {
+ "GET /test/sleep500 HTTP/1.1\r\n"
+ "Connection: Keep-Alive\r\n"
+ "Content-Length: 0\r\n"
+ "\r\n"
+ "GET /test/sleepName HTTP/1.1\r\n"
+ "Connection: Keep-Alive\r\n"
+ "Transfer-Encoding: chunked\r\n"
+ "\r\n"
+ "4\r\n"
+ "this\r\n"
+ "6\r\n"
+ " is a \r\n"
+ "5\r\n"
+ "name!\r\n"
+ "0\r\n"
+ "\r\n")
.getBytes());
InputStream in = socket.getInputStream();