Files
waf-platform/EdgeHttpDNS/sdk/ios/AlicloudHttpDNSTests/Network/HttpdnsNWHTTPClientTestHelper.h
2026-02-28 18:55:33 +08:00

59 lines
2.0 KiB
Objective-C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// 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 å“<C3A5>应数æ<C2B0>®æž„é€?
// 构造标å‡?HTTP å“<C3A5>应数æ<C2B0>®
+ (NSData *)createHTTPResponseWithStatus:(NSInteger)statusCode
statusText:(NSString *)statusText
headers:(nullable NSDictionary<NSString *, NSString *> *)headers
body:(nullable NSData *)body;
// æž„é€?chunked ç¼ç <C3A7>çš?HTTP å“<C3A5>应
+ (NSData *)createChunkedHTTPResponseWithStatus:(NSInteger)statusCode
headers:(nullable NSDictionary<NSString *, NSString *> *)headers
chunks:(NSArray<NSData *> *)chunks;
// æž„é€?chunked ç¼ç <C3A7>çš?HTTP å“<C3A5>应(带 trailersï¼?
+ (NSData *)createChunkedHTTPResponseWithStatus:(NSInteger)statusCode
headers:(nullable NSDictionary<NSString *, NSString *> *)headers
chunks:(NSArray<NSData *> *)chunks
trailers:(nullable NSDictionary<NSString *, NSString *> *)trailers;
#pragma mark - Chunked ç¼ç <C3A7>工具
// ç¼ç <C3A7>å<EFBFBD>•个 chunk
+ (NSData *)encodeChunk:(NSData *)data;
// ç¼ç <C3A7>å<EFBFBD>•个 chunk(带 extensionï¼?
+ (NSData *)encodeChunk:(NSData *)data extension:(nullable NSString *)extension;
// ç¼ç <C3A7>终止 chunk(size=0ï¼?
+ (NSData *)encodeLastChunk;
// ç¼ç <C3A7>终止 chunk(带 trailersï¼?
+ (NSData *)encodeLastChunkWithTrailers:(NSDictionary<NSString *, NSString *> *)trailers;
#pragma mark - æµè¯•æ•°æ<C2B0>®ç”Ÿæˆ<C3A6>
// 生æˆ<C3A6>指定大å°<C3A5>çš„éš<C3A9>机数æ<C2B0>?
+ (NSData *)randomDataWithSize:(NSUInteger)size;
// 生æˆ<C3A6> JSON æ ¼å¼<C3A5>çš„å“<C3A5>应体
+ (NSData *)jsonBodyWithDictionary:(NSDictionary *)dictionary;
@end
NS_ASSUME_NONNULL_END