php - App, webserver and Json -
I have a web server that accepts post requests with a string
Value1 = 1 & amp; ; Value2 = 2 Now I'm writing an app that is connected to that web server and request a post for it. My post request is sent as a dictionary object
request.HTTPMethod = "POST" request.HTTPBody = NSJSONSerialization.dataWithJSONObject (params, option: zero, error: and error) request. The web server request will not be read because addValue ("application / x-www-form-urlencoded", forHTTPHeaderField: "content-type"), because it is an object and it only returns that string Reads the form. Is it better to send the string as necessary to the server, or is the web server code safe for obtaining an object for better security performance?
You can not say in general it depends on the complexity of the object being sent. If it's just key-value pairs without any "sub-objects" then I like leaving the server as soon as possible.
If it is more complex, then you can use JSON in the body. (In this case, change mime type, in fact you are saying that you send encoded URLs, but you do not do it. Of course this should not work.) We did it in the cloud, but added support for various MIM types OK, because it is broadcast on data.
Please note that you can only send dictionaries et al by using NSJSONSerializer . If you have recurring objects of a custom class, then you have to convert them into supported classes.
Comments
Post a Comment