How to use the http-status-codes.ACCEPTED function in http-status-codes

To help you get started, we’ve selected a few http-status-codes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github portinariui / portinari-angular / projects / sync / src / lib / services / po-event-sourcing / po-event-sourcing.service.ts View on Github external
import { PoSchemaDefinitionService } from './../po-schema/po-schema-definition/po-schema-definition.service';
import { PoSchemaService } from './../po-schema/po-schema.service';
import { PoSchemaUtil } from './../po-schema/po-schema-util/po-schema-util.model';
import { PoSyncConfig } from '../po-sync/interfaces/po-sync-config.interface';
import { PoSyncResponse } from '../po-sync/interfaces/po-sync-response.interface';
import { PoSyncSchema } from './../po-sync/interfaces/po-sync-schema.interface';

@Injectable()
export class PoEventSourcingService {

  static readonly event_sourcing_name: string = 'EventSourcing';

  private static readonly VALID_HTTP_STATUS_CODES = [
    HttpStatus.OK, // 200
    HttpStatus.CREATED, // 201
    HttpStatus.ACCEPTED, // 202
    HttpStatus.NON_AUTHORITATIVE_INFORMATION, // 203
    HttpStatus.NO_CONTENT, // 204
    HttpStatus.RESET_CONTENT, // 205
    HttpStatus.PARTIAL_CONTENT, // 206
    HttpStatus.MULTI_STATUS, // 207
  ];

  config: PoSyncConfig;
  stoppedQueueEventSourcing: boolean = false;

  private emitter: any;
  private eventSub: Observable;
  private responseSubject = new Subject();

  private schemasSyncConfig = {};
github Azure / meta-azure-service-broker / lib / common / reply.js View on Github external
switch (statusCode) {
    case HttpStatus.OK:
      reply = {
        statusCode: altStatusCode || HttpStatus.OK,
        code: altCode || HttpStatus.getStatusText(HttpStatus.OK),
        value: {
          state: 'Succeeded',
          description: 'Operation was successful.'
        }
      };
      break;

    case HttpStatus.ACCEPTED:
      reply = {
        statusCode: altStatusCode || HttpStatus.ACCEPTED,
        code: altCode || HttpStatus.getStatusText(HttpStatus.ACCEPTED),
        value: {
          state: 'Succeeded',
          description: 'Operation was successful.'
        }
      };
      break;

    case HttpStatus.INTERNAL_SERVER_ERROR:
      reply = {
        statusCode: altStatusCode || HttpStatus.INTERNAL_SERVER_ERROR,
        code: altCode || HttpStatus.getStatusText(HttpStatus.INTERNAL_SERVER_ERROR),
        value: {
          state: 'Failed',
          description: 'Operation failed. Check the log for details.'
        }
      };
github Azure / meta-azure-service-broker / lib / common / reply.js View on Github external
var Reply = function(statusCode, altStatusCode, altCode) {
  var reply = {};
  switch (statusCode) {
    case HttpStatus.OK:
      reply = {
        statusCode: altStatusCode || HttpStatus.OK,
        code: altCode || HttpStatus.getStatusText(HttpStatus.OK),
        value: {
          state: 'Succeeded',
          description: 'Operation was successful.'
        }
      };
      break;

    case HttpStatus.ACCEPTED:
      reply = {
        statusCode: altStatusCode || HttpStatus.ACCEPTED,
        code: altCode || HttpStatus.getStatusText(HttpStatus.ACCEPTED),
        value: {
          state: 'Succeeded',
          description: 'Operation was successful.'
        }
      };
      break;

    case HttpStatus.INTERNAL_SERVER_ERROR:
      reply = {
        statusCode: altStatusCode || HttpStatus.INTERNAL_SERVER_ERROR,
        code: altCode || HttpStatus.getStatusText(HttpStatus.INTERNAL_SERVER_ERROR),
        value: {
          state: 'Failed',
github Azure / meta-azure-service-broker / lib / services / azurerediscache / index.js View on Github external
cp.deprovision(redisClient, function (err, result) {
    if (err) {
      common.handleServiceError(err, next);
    } else {
      next(null, Reply(HttpStatus.ACCEPTED), result);
    }
  });
};
github Azure / meta-azure-service-broker / lib / services / azuredocdb / index.js View on Github external
cp.provision(docDbClient, function(err, result) {
    if (err) {
      common.handleServiceError(err, next);
    } else {
      next(null, Reply(HttpStatus.ACCEPTED), result);
    }
  });
};
github Aenima4six2 / screenie / src / server / routes / notifications.js View on Github external
router.post('/slack', handleRejections(async (req, res) => {
  const token = req.body.token
  if (!token) return res.sendStatus(statusCode.BAD_REQUEST)

  const message = req.body.message
  if (!message) return res.sendStatus(statusCode.BAD_REQUEST)
  res.sendStatus(statusCode.ACCEPTED)

  const dsm = req.dashboardSocketManager
  const dashboards = await Dashboard.find({ webhookTokens: [token] })
  dashboards.forEach(dashboard => {
    dsm.sendDashboardNotification(message, dashboard.id)
  })
}))
github Prior99 / hyrest / packages / hyrest / src / answers.ts View on Github external
export function accepted(arg1: T | string | Wrapper, arg2?: string): T {
    return answer(HTTP.ACCEPTED, arg1, arg2);
}
github Azure / meta-azure-service-broker / lib / services / azureservicebus / index.js View on Github external
utils.delNamespace(azure_config, function(err) {
    if (err) {
      common.handleServiceError(err, next);
    } else {
      var reply = {
        statusCode: HttpStatus.ACCEPTED,
        code: HttpStatus.getStatusText(HttpStatus.ACCEPTED),
        value: {}
      };
      next(null, reply, provisioningResult);
    }
  });
};
github Azure / meta-azure-service-broker / lib / services / azureeventhubs / index.js View on Github external
utils.delNamespace(azure_config, function(err) {
    if (err) {
      common.handleServiceError(err, next);
    } else {
      var reply = {
        statusCode: HttpStatus.ACCEPTED,
        code: HttpStatus.getStatusText(HttpStatus.ACCEPTED),
        value: {}
      };
      next(null, reply, provisioningResult);
    }
  });
};
github Azure / meta-azure-service-broker / lib / services / azuresqldbfailovergroup / client.js View on Github external
msRestRequest.PUT(that.failoverGroupUrl, headers, body, API_VERSIONS.SQLFG, function (err, res, body) {
    if (err) {
      log.info('client: createFailoverGroup: err %j', err);
      return callback(err, null);
    }

    common.logHttpResponse(res, 'client - createFailoverGroup', true);

    if (res.statusCode == HttpStatus.ACCEPTED) {
      callback(null, res['headers']['azure-asyncoperation']);
    } else if (res.statusCode == HttpStatus.OK || res.statusCode == HttpStatus.NO_CONTENT) {
      callback(null);
    } else {
      return common.formatErrorFromRes(res, callback);
    }
  });