title: frisby.js post body content syntax
body: <p>I have a UI and server data exchange that works well but I wanted to start testing new development with Frisby.js. The UI has a JavaScript form manager that uses jQuery.  My request body is a JavaScript object that is first serialized with JSON.stringify.</p>
  
  <pre><code>var msg = {form:"login",data{username:"elmer",password:"wabbit"}};
  var json_msg = JSON.stringify(msg);
  </code></pre>
  
  <p>Then it is sent by jQuery:</p>
  
  <pre><code>$.ajax(
      url: baseUrl+"forms/"+call,
      data: { req: json_msg },
      type: "POST",
      success: function(msg){...
  </code></pre>
  
  <p>The raw body content received at the server looks like this:</p>
  
  <pre><code>req=%7B%22form%22%3A%22login%22%2C%22data%22%3A%7B%22username%22%3A%22elmer%22%2C%22password%22%3A%wabbit%22%7D%7D
  </code></pre>
  
  <p>Since this raw body content is what my server expects and uses successfully, I have tried several combinations of content-type headers and content formats but Frisby.js chokes on them or sends the wrong body.</p>
  
  <p>NOTE: 
  1. First the message (a JavaScript object) must be serialized.
  2. Then req=[serialized_message] must be URIencoded.
  These two steps are performed easily with jQuery.ajax() but seemingly are
  impossible on Frisby.js</p>
  
  <p>I tried:
    using unserialized JavaScript object,
    using serialized JavaScript object and
    serialized and URIencoded text (shown here)</p>
  
  <pre><code>msg = "%7B%22form%22%3A%22login%22%2C%22data%22%3A%7B%22username%22%3A%22elmer%22%2C%22password%22%3A%wabbit%22%7D%7D";
  
  frisby.create('Login on HHHLEG web site.')
    .addHeader('X-Requested-With', 'XMLHttpRequest')
    .post('http://hhhleg/forms/login', req=msg )
  </code></pre>
  
  <p>The above code ends up with nothing in the body when it gets to the server.  I suspect there is some simple syntax issue or a content-type issue or Frisby.js cannot perform the combination of serialization and URI encoding because it chokes on the characters involved.</p>