zoukankan      html  css  js  c++  java
  • request请求 HTTPBody 格式

    //Json格式
     
        [mtbRequset setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
        NSError *error;
        NSData *body = [NSJSONSerialization dataWithJSONObject:bodyDict options:NSJSONWritingPrettyPrinted error:&error];
        if (error) {
            MBErrorLog(@"%@", error);
        }
        mtbRequset.HTTPBody = body;
     
     
    //x-www-form-urlencoded格式
        NSString *bodyStr = @"type=shentong&postid=3333557693903";
        mutablerequest.HTTPBody = [bodyStr dataUsingEncoding:NSUTF8StringEncoding];
        [mutablerequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
     
  • 相关阅读:
    ajax01
    django04
    数据库
    WeakHashMap类
    IdentityHashMap
    Hashtable类
    LinkedHashMap类
    HashMap和TreeMap类
    PriorityQueue
    Synchronized
  • 原文地址:https://www.cnblogs.com/sunjianfei/p/8117073.html
Copyright © 2011-2022 走看看