HttpResponse
public class HttpResponse
源码Source
io/agentscope/core/model/transport/HttpResponse.java:27–146HTTP 响应,与模型服务通信并返回生成或向量化结果。位于 io.agentscope.core.model.transport 包。核心成员包括 getStatusCode、getHeaders、getBody、isSuccessful、builder。
HTTP response encapsulation for the transport layer.
This class represents an HTTP response with status code, headers, and body.
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Builder | 类class | HttpResponse的构建器。 Builder for HttpResponse. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public int getStatusCode() | 获取 `getStatusCode`。 Get the HTTP status code. |
public Map<String, String> getHeaders() | 获取响应请求头。 Get the response headers. |
public String getBody() | 获取响应正文。 Get the response body. |
public boolean isSuccessful() | 判断是否 `isSuccessful`。 Check if the response indicates success (2xx status code). |
public static Builder builder()static | 创建用于HttpResponse的构建器。 Create a new builder for HttpResponse. |
方法详情Method Detail
getStatusCode
public int getStatusCode()
获取 getStatusCode。
Get the HTTP status code.
int返回数值结果。the status code
源码Source
io/agentscope/core/model/transport/HttpResponse.java:44–46getHeaders
public Map<String, String> getHeaders()
获取响应请求头。
Get the response headers.
Map<String, String>返回映射。an unmodifiable map of headers
源码Source
io/agentscope/core/model/transport/HttpResponse.java:53–55getBody
public String getBody()
获取响应正文。
Get the response body.
String返回字符串结果。the body string, or null if no body
源码Source
io/agentscope/core/model/transport/HttpResponse.java:62–64isSuccessful
public boolean isSuccessful()
判断是否 isSuccessful。
Check if the response indicates success (2xx status code).
boolean返回布尔值,表示判断结果。true if status code is 2xx
源码Source
io/agentscope/core/model/transport/HttpResponse.java:71–73builder
public static Builder builder()
static
创建用于HttpResponse的构建器。
Create a new builder for HttpResponse.
Builder一种新的构建器实例。a new Builder instance
源码Source
io/agentscope/core/model/transport/HttpResponse.java:80–82嵌套类详情Nested Class Detail
Builder
public static class BuilderHttpResponse的构建器。位于 io.agentscope.core.model.transport 包。核心成员包括 statusCode、header、headers、body、build。
Builder for HttpResponse.