lib/plugins/aws/deploy/compile/events/apiGateway/lib/methods.js/generateResponse
    const generateResponse = (responseConfig) => {
      const response = {
        methodResponses: [],
        integrationResponses: [],
      };

      const statusCodes = {};
      Object.assign(statusCodes, responseConfig.statusCodes);

      if (!hasDefaultStatusCode(statusCodes)) {
        _.merge(statusCodes, { 200: defaultStatusCodes['200'] });
      }

      Object.keys(statusCodes).forEach((statusCode) => {
        const methodResponse = {
          ResponseParameters: {},
          ResponseModels: {},
          StatusCode: parseInt(statusCode, 10),
        };

        const integrationResponse = {
          StatusCode: parseInt(statusCode, 10),
          SelectionPattern: statusCodes[statusCode].pattern || '',
          ResponseParameters: {},
          ResponseTemplates: {},
        };

        _.merge(methodResponse.ResponseParameters,
          generateMethodResponseHeaders(responseConfig.methodResponseHeaders));
        if (statusCodes[statusCode].headers) {
          _.merge(methodResponse.ResponseParameters,
            generateMethodResponseHeaders(statusCodes[statusCode].headers));
        }

        _.merge(integrationResponse.ResponseParameters,
          generateIntegrationResponseHeaders(responseConfig.integrationResponseHeaders));
        if (statusCodes[statusCode].headers) {
          _.merge(integrationResponse.ResponseParameters,
           generateIntegrationResponseHeaders(statusCodes[statusCode].headers));
        }

        if (responseConfig.integrationResponseTemplate) {
          _.merge(integrationResponse.ResponseTemplates, {
            'application/json': responseConfig.integrationResponseTemplate,
          });
        }

        if (statusCodes[statusCode].template) {
          if (typeof statusCodes[statusCode].template === 'string') {
            _.merge(integrationResponse.ResponseTemplates, {
              'application/json': statusCodes[statusCode].template,
            });
          } else {
            _.merge(integrationResponse.ResponseTemplates, statusCodes[statusCode].template);
          }
        }

        response.methodResponses.push(methodResponse);
        response.integrationResponses.push(integrationResponse);
      });

      return response;
    };