title: Express post failing on changed parameter with Q service
body: <p>I have an endpoint in express which returns a promise and passes in a parameter from the req object. This works fine until a the parameter changes. </p>
  
  <p>Here is my endpoint:</p>
  
  <pre><code>app.post('/guid', function (req, res) {
    var id = req.body.id;     
    guid.assureGUID(id).then(function(data){
      res.send(data);
    });
  })
  </code></pre>
  
  <p><code>localhost:3000/guid/1234</code> would work fine, but when a new parameter is passed in <code>localhost:3000/guid/1235</code> the service returns an error. </p>
  
  <p>Here is my guid module</p>
  
  <pre><code>var express    = require('express');
  var Q          = require('q');
  var request    = require('request');
  var uuid       = require('uuid');
  var util       = require('util');
  var tempId;
  
  module.exports = function(app){
  
  
  var assureGUID = function(id) {
      return getGUID(id);
  };
  
  
  var getGUID = function(id) {
  
      var deferred = Q.defer();
       console.log(id);
  
      var getGUIDOptions = {
        url: 'http://third-party-endpoint',
        method: 'POST',
        json: {
          "guid": id
        }
      };
  
      request(getGUIDOptions, function(err,resp,body){
        if(err){
          console.log(err);
          return;
        }
        if(200 !== resp.statusCode){
          console.log(new Error('failed to retrieve GUID, status='+resp.statusCode));
          return;
        }
        if(!('object'===typeof body &amp;&amp; 'string'===typeof body.guid &amp;&amp; body.guid)){
          console.log(new Error('failed to retrieve GUID, resp: '+util.inspect(resp,{depth:null})));
          return;
        }
        deferred.resolve(body.guid);
        app.locals.guid = body.guid;
      });
  
    return deferred.promise;
  
  };
  
  
  
  return {
          assureGUID: assureGUID
      }
  
  }
  </code></pre>