WebRequest
A robust HTTP client solution for Unity, offering flexible API management, automatic retries, and comprehensive request handling using .NET's HttpClient.
In One Line
REST assured, your requests are in good hands!
Overview
AceLand WebRequest is a modern web request solution designed specifically for Unity projects, providing a fluent interface for API calls with built-in error handling, retry mechanisms, and API section management. It uses .NET's HttpClient instead of UnityWebRequest for better performance and more control.
Package Info
display name
AceLand WebRequest
package name
latest version
1.0.10
namespace
git repository
dependencies
Why Use It?
Modern Architecture: Built on .NET's HttpClient for better performance and reliability
Flexible API Management: Test and switch between different API configurations in editor
Built-in Retry Logic: Automatic retry mechanism with configurable intervals
Type-Safe Builder Pattern: Fluent interface for building requests with compile-time safety
Comprehensive Error Handling: Detailed error logging and exception management
Multiple Content Types: Support for JSON, Form, and Multipart request types
Key Features
Custom retry intervals and timeout settings
Comprehensive logging system with different build levels
HTTPS enforcement option
Automatic timestamp header injection
JSON validation before sending
Support for cancellation tokens
Editor tools for API section management
Project Settings
Logging
---
Logging Level
Level of Logging on web request
default: BuildLevel.Production
Result Logging Level
Level of Logging on request success
default: BuildLevel.DevelopmentBuild
Checking Options
---
Check Json Before Send
Check given content is a valid json before send request.
This may be expensive if big content.
Default: false
Force Https Scheme
Require request url is https if true. Otherwise http will also ok.
Default: true
Header Auto Fill
---
Add Time In Header
Add send time in header automatically.
Default: true
Time Key
key of Time in header.
default: Time
Auto Fill Headers
Add default headers on each Request.
Same headers will be covered by WithHeaders options on building Request.
Default: { "User-Agent", "Mozilla/5.0" }
Request Options
---
Request Timeout
Default timeout if not set in request handle.
Default: 3000
ms
Long Request Timeout
Default long request timeout. It will be set if building request handle with long request.
Default: 15000
ms
Request Retry
How many times will retry on connection error including timeout.
Default: 3
Retry Interval
Interval between each retry.
Default: [ 400, 800, 1600, 3200, 6400, 12800, 25600]
in ms
Current API Section
---
Section
[Lock] Current API section.
Domain
[Lock] Current API Domain.
Version
[Lock] Current API Version.
-
button
Clear Current API Section Data.
Api Url
[Lock] API URL of current section.
API Section Editor
---
Table
This is API Sections Data. All data is saved in
Assets/Editor/AceLand/api_sections.asset
that confirms non-used data will not be built.
Last line is an empty line for adding new data.
-
delete data *
apply to Current API Section
+
add data
Save
save to asset Restore
restore unsaved changes
Usage
Sample of Weather Widget
For example, there is a Weather Widget on canvas. It will refresh every set time.
Advanced Sample
This is a sample of building a User Authorization API serivce and how to use it.
Last updated