How to print AFNetworking request as RAW data

前端 未结 4 803
轮回少年
轮回少年 2020-12-13 01:39

For debuging purposes I\'d want to print whole request body. I\'m using AFHTTPClient. printing client gives some information, like headers but post/get params are not there.

4条回答
  •  抹茶落季
    2020-12-13 01:45

    You should have a look at https://github.com/AFNetworking/AFHTTPRequestOperationLogger with AFLoggerLevelDebug as level of debugging.

    #import "AFHTTPRequestOperationLogger.h"
    
    @implementation AppDelegate
    
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
    #ifdef DEBUG
        [[AFHTTPRequestOperationLogger sharedLogger] startLogging];
        [[AFHTTPRequestOperationLogger sharedLogger] setLevel:AFLoggerLevelDebug];
    #endif
        return YES;
    }
    
    @end
    

提交回复
热议问题