VelocityHttpClient class

Velocity HTTP客户端

Constructors

VelocityHttpClient({String baseUrl = '', Map<String, String> defaultHeaders = const {}, Duration timeout = const Duration(seconds: 30), List<VelocityRequestInterceptor>? requestInterceptors, List<VelocityResponseInterceptor>? responseInterceptors, List<VelocityErrorInterceptor>? errorInterceptors})
创建Velocity HTTP客户端

Properties

baseUrl → String
基础URL
final
defaultHeaders → Map<String, String>
默认请求头
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
timeout → Duration
默认超时时间
final

Methods

addErrorInterceptor(VelocityErrorInterceptor interceptor) → void
添加错误拦截器
addRequestInterceptor(VelocityRequestInterceptor interceptor) → void
添加请求拦截器
addResponseInterceptor(VelocityResponseInterceptor interceptor) → void
添加响应拦截器
clearErrorInterceptors() → void
清空错误拦截器
clearRequestInterceptors() → void
清空请求拦截器
clearResponseInterceptors() → void
清空响应拦截器
close() → void
关闭HTTP客户端
delete(String url, Map<String, String> headers, Map<String, dynamic> queryParameters) → Future<VelocityHttpResponse>
发送DELETE请求
get(String url, Map<String, dynamic> queryParameters, Map<String, String> headers) → Future<VelocityHttpResponse>
发送GET请求
发送HEAD请求
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
options(String url, Map<String, String> headers, Map<String, dynamic> queryParameters) → Future<VelocityHttpResponse>
发送OPTIONS请求
patch(String url, dynamic body, Map<String, String> headers, Map<String, dynamic> queryParameters) → Future<VelocityHttpResponse>
发送PATCH请求
post(String url, dynamic body, Map<String, String> headers, Map<String, dynamic> queryParameters) → Future<VelocityHttpResponse>
发送POST请求
put(String url, dynamic body, Map<String, String> headers, Map<String, dynamic> queryParameters) → Future<VelocityHttpResponse>
发送PUT请求
removeErrorInterceptor(VelocityErrorInterceptor interceptor) → void
移除错误拦截器
removeRequestInterceptor(VelocityRequestInterceptor interceptor) → void
移除请求拦截器
removeResponseInterceptor(VelocityResponseInterceptor interceptor) → void
移除响应拦截器
request({required String url, required VelocityHttpMethod method, Map<String, String> headers = const {}, dynamic body, Map<String, dynamic> queryParameters = const {}, Duration? timeout, Encoding encoding = utf8}) → Future<VelocityHttpResponse>
发送HTTP请求
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited