feat: sync httpdns sdk/platform updates without large binaries
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// HttpdnsNWHTTPClientTestHelper.h
|
||||
// TrustHttpDNSTests
|
||||
//
|
||||
// @author Created by Claude Code on 2025-11-01
|
||||
// Copyright © 2025 trustapp.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface HttpdnsNWHTTPClientTestHelper : NSObject
|
||||
|
||||
#pragma mark - HTTP 响应数据构<E68DAE><E69E84>?
|
||||
|
||||
// 构造标<E980A0><E6A087>?HTTP 响应数据
|
||||
+ (NSData *)createHTTPResponseWithStatus:(NSInteger)statusCode
|
||||
statusText:(NSString *)statusText
|
||||
headers:(nullable NSDictionary<NSString *, NSString *> *)headers
|
||||
body:(nullable NSData *)body;
|
||||
|
||||
// 构<><E69E84>?chunked 编码<E7BC96><E7A081>?HTTP 响应
|
||||
+ (NSData *)createChunkedHTTPResponseWithStatus:(NSInteger)statusCode
|
||||
headers:(nullable NSDictionary<NSString *, NSString *> *)headers
|
||||
chunks:(NSArray<NSData *> *)chunks;
|
||||
|
||||
// 构<><E69E84>?chunked 编码<E7BC96><E7A081>?HTTP 响应(带 trailers<72><73>?
|
||||
+ (NSData *)createChunkedHTTPResponseWithStatus:(NSInteger)statusCode
|
||||
headers:(nullable NSDictionary<NSString *, NSString *> *)headers
|
||||
chunks:(NSArray<NSData *> *)chunks
|
||||
trailers:(nullable NSDictionary<NSString *, NSString *> *)trailers;
|
||||
|
||||
#pragma mark - Chunked 编码工具
|
||||
|
||||
// 编码单个 chunk
|
||||
+ (NSData *)encodeChunk:(NSData *)data;
|
||||
|
||||
// 编码单个 chunk(带 extension<6F><6E>?
|
||||
+ (NSData *)encodeChunk:(NSData *)data extension:(nullable NSString *)extension;
|
||||
|
||||
// 编码终止 chunk(size=0<><30>?
|
||||
+ (NSData *)encodeLastChunk;
|
||||
|
||||
// 编码终止 chunk(带 trailers<72><73>?
|
||||
+ (NSData *)encodeLastChunkWithTrailers:(NSDictionary<NSString *, NSString *> *)trailers;
|
||||
|
||||
#pragma mark - 测试数据生成
|
||||
|
||||
// 生成指定大小的随机数<E69CBA><E695B0>?
|
||||
+ (NSData *)randomDataWithSize:(NSUInteger)size;
|
||||
|
||||
// 生成 JSON 格式的响应体
|
||||
+ (NSData *)jsonBodyWithDictionary:(NSDictionary *)dictionary;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
Reference in New Issue
Block a user