AS AgentScopeAPI 手册 / API Reference

HttpResponse

public class HttpResponse
源码Source io/agentscope/core/model/transport/HttpResponse.java:27–146

HTTP 响应,与模型服务通信并返回生成或向量化结果。位于 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.

返回Returns int
返回数值结果。the status code
源码Source io/agentscope/core/model/transport/HttpResponse.java:44–46

getHeaders

public Map<String, String> getHeaders()

获取响应请求头。

Get the response headers.

返回Returns Map<String, String>
返回映射。an unmodifiable map of headers
源码Source io/agentscope/core/model/transport/HttpResponse.java:53–55

getBody

public String getBody()

获取响应正文。

Get the response body.

返回Returns String
返回字符串结果。the body string, or null if no body
源码Source io/agentscope/core/model/transport/HttpResponse.java:62–64

isSuccessful

public boolean isSuccessful()

判断是否 isSuccessful。

Check if the response indicates success (2xx status code).

返回Returns boolean
返回布尔值,表示判断结果。true if status code is 2xx
源码Source io/agentscope/core/model/transport/HttpResponse.java:71–73

builder

public static Builder builder()
static

创建用于HttpResponse的构建器。

Create a new builder for HttpResponse.

返回Returns Builder
一种新的构建器实例。a new Builder instance
源码Source io/agentscope/core/model/transport/HttpResponse.java:80–82

嵌套类详情Nested Class Detail

Builder

public static class Builder

HttpResponse的构建器。位于 io.agentscope.core.model.transport 包。核心成员包括 statusCode、header、headers、body、build。

Builder for HttpResponse.

基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.