//
//  LTHTTPResponse.h
//  LTUnionSDK
//
//  Created by 孙泉 on 2017/6/30.
//  Copyright © 2017年 孙泉. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface LTHTTPResponse : NSObject

#pragma mark - 属性

/**
 响应数据
 */
@property (nonatomic, strong) NSData *data;

/**
 响应数据字符串
 */
@property (nonatomic, strong, readonly) NSString *responseString;

/**
 响数据JSON
 */
@property (nonatomic, strong, readonly) id responseJSON;

/**
 响应错误
 */
@property (nonatomic, strong) NSError *error;

/**
 响应对象
 */
@property (nonatomic, strong) NSHTTPURLResponse *nsResponse;

/**
 响应地址
 */
@property (nonatomic, copy, readonly) NSURL *URL;

/**
 响应码
 */
@property (nonatomic, assign, readonly) NSInteger statusCode;

/**
 所有HTTP头
 */
@property (nonatomic, copy, readonly) NSDictionary *allHeaderFields;

/**
 本地化响应码
 */
@property (nonatomic, copy, readonly) NSString *localizedStatusString;

#pragma mark - 初始化

/**
 初始化方法
 */
- (instancetype)initWithURLResponse:(NSURLResponse *)response;

/**
 生成response对象
 */
+ (instancetype)responseWithURLResponse:(NSURLResponse *)response;

@end
