title: How to add HTTPBody in NSMutableURLRequest in iOS?
body: <p>I am passing HTTPBody in my request. But its unable to get proper response.</p>
  
  <p>below is my code :</p>
  
  <pre><code>NSURL *url = [NSURL URLWithString:@"https://sample.ios.com/l1/voucher"];
  NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
  
  [request setHTTPMethod:@"POST"];
  
  [request setValue:@"text/html; charset=UTF-8" forHTTPHeaderField:@"Content-Type"];
  
  //Now pass your own parameter --------
  
  [request setValue:@"g064a4b5aa95556a7b0b4435d94c317840e9b456" forHTTPHeaderField:@"X-Authorization"];
  [request setValue:@"123651236512" forHTTPHeaderField:@"uuid"];
  [request setValue:@"myIphone" forHTTPHeaderField:@"devicename"];
  
  
  NSString *myRequestString =@"voucher=JHAHSDGH-80";
  NSLog(@"%@",myRequestString);
  NSData *myRequestData = [ NSData dataWithBytes: [ myRequestString UTF8String ] length: [ myRequestString length ] ];
  [ request setHTTPBody: myRequestData ];
  
  NSURLResponse *response;
  NSError *err;
  NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&amp;response error:&amp;err];
  NSString *content = [NSString stringWithUTF8String:[responseData bytes]];
  NSLog(@"content : %@",content);
  </code></pre>
  
  <p>Output is coming like below :</p>
  
  <pre><code>content : {"voucher":["The voucher field is required."]}
  </code></pre>
  
  <p>So how can I set HTTPBody ?</p>
  
  <p>Please help me. </p>