title: JSON in cy.request body
body: <p>In our web app, we have options that can be changed in using a POST HTTP request. There are a good number of options, and I will be writing a new test for each one, so I don't want to use the UI to change each option, seeing as there are 150 of them. SO my idea was to set up a custom command that I could feed arguments into (the argument being which option I want to update, and the new value for that option). </p>
  
  <p>I put the list of options in a fixture, so it is in a JSON object. I was able to get to the point where I can find the key I'm looking for and update the value from the fixture, but I am running into an issue where my cy.request won't actually send any data. I've tried updating the headers, updating the body, setting json:true. Nothing works. So I'm hoping someone here will have some advice.</p>
  
  <pre><code>//fixture.json
  {
      "option1":"on",
      "option2":"off",
      "option3":"off
  }
  </code></pre>
  
  <pre><code>//commands.js
  Cypress.Commands.add('update_options',(option, newValue) =&gt; {
      cy.fixture('fixture.json').then((oldBody)=&gt;{
          let newBody = Objects.assign({},oldBody);//copy old options list into new object
  
        function replace(option, newBody){
            newBody[option]=newValue;
        }
        replace(option,newValue);
  
        cy.request({
            method:'POST',
            url:'myURLwithParams',
            form: true,
            json: true,
            body: newBody
        })
      });
  });
  </code></pre>
  
  <pre><code>//spec.js
  cy.update_options("options1", "off");
  </code></pre>
  
  <p>I can get the new object with the updated code and everything, so that all works. The only thing I can't figure out is how to get it to actually POST. The JSON just doesn't compile correctly. I tried JSON.stringify(newBody) - no luck. I've tried every combination of everything I've mentioned and can't get it to work.</p>