git-off

git off handles large files in git repos
git clone https://noulin.net/git/git-off.git
Log | Files | Refs | README

apigateway.js (869B)


      1 var AWS = require('../core');
      2 
      3 AWS.util.update(AWS.APIGateway.prototype, {
      4 /**
      5  * Sets the Accept header to application/json.
      6  *
      7  * @api private
      8  */
      9   setAcceptHeader: function setAcceptHeader(req) {
     10     var httpRequest = req.httpRequest;
     11     httpRequest.headers['Accept'] = 'application/json';
     12   },
     13 
     14   /**
     15    * @api private
     16    */
     17   setupRequestListeners: function setupRequestListeners(request) {
     18     request.addListener('build', this.setAcceptHeader);
     19     if (request.operation === 'getSdk') {
     20       request.addListener('extractData', this.useRawPayload);
     21     }
     22   },
     23 
     24   useRawPayload: function useRawPayload(resp) {
     25     var req = resp.request;
     26     var operation = req.operation;
     27     var rules = req.service.api.operations[operation].output || {};
     28     if (rules.payload) {
     29       var body = resp.httpResponse.body;
     30       resp.data[rules.payload] = body;
     31     }
     32   }
     33 });
     34