zoukankan      html  css  js  c++  java
  • %3f URL --> '?'拼接引发的问题

     
     

     

    [–]lyinstevemod 2 points 1 year ago 

    If you're using Alamofire, you should really be submitting URL encoded parameters as a dictionary instead, because Alamofire handles serialization. You're doing more work than you should.

     

    [–]xStory_Timex[S1 point 1 year ago 

    I don't understand, can you explain more

     

    [–]lyinstevemod 1 point 1 year ago 

    So right now you're adding URL parameters, right? And you're serializing them into a string yourself.

    You also said you're using Alamofire. Alamofire will actually take those arguments in a Dictionary as a parameter to the request() function. You don't need to -- and shouldn't -- manually create those strings.

    Specifically just

    ?brand_id=(id)
    

    Instead, pass the parameters into the Alamofire request() function.

    Alamofire.request(
       .GET,
       "/products",
       parameters: ["brand_id": id]
    )
    
     
     
     
     
     
     
     
  • 相关阅读:
    java——io、字节流缓冲区拷贝文件、字节缓冲流
    java——斗地主小游戏之洗牌发牌
    java——HashMap、Hashtable
    java——模拟新浪微博用户注册
    [bzoj 1492][NOI2007]货币兑换Cash
    [bzoj 1010][HNOI 2008]玩具装箱
    [bzoj 2875][noi2012]随机数生成器
    [bzoj 4872][六省联考2017]分手是祝愿
    [bzoj 3566][SHOI 2014]概率充电器
    [bzoj 3534][Sdoi2014] 重建
  • 原文地址:https://www.cnblogs.com/Jenaral/p/5638645.html
Copyright © 2011-2022 走看看