title: update a file content in SharePoint document library with REST - javascript
body: <p>I want to update a file in SharePoint document library with the following code. As descriptions in:
  <a href="http://msdn.microsoft.com/en-us/library/office/dn450841%28v=office.15%29.aspx#bk_FileRequestExamples" rel="nofollow">http://msdn.microsoft.com/en-us/library/office/dn450841(v=office.15).aspx#bk_FileRequestExamples</a>
  <a href="http://msdn.microsoft.com/en-us/library/office/dn292553%28v=office.15%29.aspx#Files" rel="nofollow">http://msdn.microsoft.com/en-us/library/office/dn292553(v=office.15).aspx#Files</a></p>
  
  <p>The executeAsync returns successful but the file isn’t update!
  Can anybody help!?</p>
  
  <pre><code>var spUrl = appWebUrl + "/_api/SP.AppContextSite(@target)/web/GetFileByServerRelativeUrl('" + itemUrl + "')/$value?@target='" + hostWebUrl + "'";
      var executor = new SP.RequestExecutor(appWebUrl);
      executor.executeAsync(
      {
          url: spUrl,
          type: "POST",
          body: "Here is the new Body",
          headers: {
              "X-HTTP-Method": "PUT",
              "X-RequestDigest": $("#__REQUESTDIGEST").val()
          },
          success: readContents,
          error: errorHandler,
          state: "Update"
      });
  </code></pre>