How to use the http-status-codes.NO_CONTENT 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 Azure / meta-azure-service-broker / lib / services / azurecosmosdb / client.js View on Github external
function (err, res, body) {
      common.logHttpResponse(res, 'CosmosDb - deleteCosmosDbAccount', true);
      if (err) {
        return callback(err);
      }
      if (res.statusCode != HttpStatus.ACCEPTED && res.statusCode != HttpStatus.NO_CONTENT) { // It returns status code 204 if the account is not existed
        return common.formatErrorFromRes(res, callback);
      }
      
      callback(null, body);
    }
  );
github Azure / meta-azure-service-broker / lib / common / resourceGroup-client.js View on Github external
function(err, response, body) {
      common.logHttpResponse(response, util.format('%s - check resource group existence', prefix), true);
      if(err) {
        log.error('%s - check resource group existence, err: %j', prefix, err);
        return callback(err);
      }
      // https://docs.microsoft.com/en-us/rest/api/resources/resourcegroups#ResourceGroups_CheckExistence
      // 204 -> existed, 404 -> not existed
      if (response.statusCode === HttpStatus.NO_CONTENT) {
        log.info('%s - check resource group existence, succeeded: existed', prefix);
        callback(null, true);
      } else if (response.statusCode === HttpStatus.NOT_FOUND) {
        log.info('%s - check resource group existence, succeeded: not existed', prefix);
        callback(null, false);
      } else {
        log.error('%s - check resource group existence, err: %j', prefix, response.body);
        return common.formatErrorFromRes(response, callback);
      }
    }
  );
github typepoint / typepoint / tests / api / handlers / todos / delete.ts View on Github external
this.define(deleteTodo, context => {
      this.todoService.remove(context.request.params.id);
      context.response.statusCode = httpStatusCodes.NO_CONTENT;
    });
  }
github CodepediaOrg / bookmarks.dev-api / routes / users / user.router.spec.js View on Github external
it('should succeed to DELETE the new created user', async function () {
    const response = await request(app)
      .delete(`${baseApiUrlUnderTest}/${testUserId}`)
      .set('Authorization', bearerToken);

    expect(response.statusCode).to.equal(HttpStatus.NO_CONTENT);
  });
github Azure / meta-azure-service-broker / lib / services / azuremysqldb / client.js View on Github external
msRestRequest.DELETE(that.serverUrl, headers, API_VERSIONS.MYSQL, function (err, res, body) {
        if (err) {
            log.error('client: deleteServer: err %j', err);
            return callback(err, null);
        }
        
        common.logHttpResponse(res, 'Delete MySQL server', true);

        if (res.statusCode === HttpStatus.NO_CONTENT) {
            log.info('client: deleteServer: NO_CONTENT');
            callback(null);
        } else {
            handleAsyncOperationRes(res, 'deleteServer', callback);
        }
    });
github Prior99 / hyrest / packages / hyrest / src / answers.ts View on Github external
export function noContent(arg1: T | string | Wrapper, arg2?: string): T {
    return answer(HTTP.NO_CONTENT, arg1, arg2);
}
github Azure / meta-azure-service-broker / lib / services / azurecosmosdb / cmd-provision.js View on Github external
cosmosDb.getCosmosDbAccount(resourceGroupName, cosmosDbAccountName, function(err, res, body) {
          if (err) {
            return callback(err);
          }
          if (res.statusCode != HttpStatus.NOT_FOUND && res.statusCode != HttpStatus.NO_CONTENT) {
            var error = new Error('The cosmosDb account name is not available.');
            error.statusCode = HttpStatus.CONFLICT;
            return callback(error);
          }
          callback(null);
        });
      },
github AceMetrix / connect-cas / lib / ssout.js View on Github external
req.on('end', function(){
            if (!/(.*)<\/samlp:SessionIndex>/.exec(body)) {
                next();
                return;
            }
            var st = RegExp.$1;

            req.sessionStore.get(st, function(err, result){
                if (result && result.sid) req.sessionStore.destroy(result.sid);
                req.sessionStore.destroy(st);
            });
            res.send(HttpStatus.NO_CONTENT);
        });
    }
github labibramadhan / mastery / src / core / services / generators / handler / DeleteHandler.js View on Github external
query = async (request, reply) => {
    await this.model.destroy({
      where: {
        [this.model.primaryKeyField]: request.params.id,
      },
    });
    return reply().code(HttpStatus.NO_CONTENT);
  }
}