Sha256: 2856be4dc08d875fda6014789f3512e80106bb20b22760debdd50864f4bd270e

Contents?: true

Size: 1.22 KB

Versions: 26

Compression:

Stored size: 1.22 KB

Contents

// src/glossary.ts
var IS_PATCHED_MODULE = Symbol("isPatchedModule");

// src/utils/isPropertyAccessible.ts
function isPropertyAccessible(obj, key) {
  try {
    obj[key];
    return true;
  } catch (e) {
    return false;
  }
}

// src/utils/responseUtils.ts
var RESPONSE_STATUS_CODES_WITHOUT_BODY = /* @__PURE__ */ new Set([
  101,
  103,
  204,
  205,
  304
]);
var RESPONSE_STATUS_CODES_WITH_REDIRECT = /* @__PURE__ */ new Set([
  301,
  302,
  303,
  307,
  308
]);
function isResponseWithoutBody(status) {
  return RESPONSE_STATUS_CODES_WITHOUT_BODY.has(status);
}
function createServerErrorResponse(body) {
  return new Response(
    JSON.stringify(
      body instanceof Error ? {
        name: body.name,
        message: body.message,
        stack: body.stack
      } : body
    ),
    {
      status: 500,
      statusText: "Unhandled Exception",
      headers: {
        "Content-Type": "application/json"
      }
    }
  );
}
function isResponseError(response) {
  return isPropertyAccessible(response, "type") && response.type === "error";
}

export {
  IS_PATCHED_MODULE,
  RESPONSE_STATUS_CODES_WITH_REDIRECT,
  isResponseWithoutBody,
  createServerErrorResponse,
  isResponseError
};
//# sourceMappingURL=chunk-XVPRNJO7.mjs.map

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
clapton-0.0.26 lib/clapton/javascripts/node_modules/@mswjs/interceptors/lib/browser/chunk-XVPRNJO7.mjs
clapton-0.0.25 lib/clapton/javascripts/node_modules/@mswjs/interceptors/lib/browser/chunk-XVPRNJO7.mjs
clapton-0.0.24 lib/clapton/javascripts/node_modules/@mswjs/interceptors/lib/browser/chunk-XVPRNJO7.mjs
clapton-0.0.23 lib/clapton/javascripts/node_modules/@mswjs/interceptors/lib/browser/chunk-XVPRNJO7.mjs
clapton-0.0.22 lib/clapton/javascripts/node_modules/@mswjs/interceptors/lib/browser/chunk-XVPRNJO7.mjs
clapton-0.0.21 lib/clapton/javascripts/node_modules/@mswjs/interceptors/lib/browser/chunk-XVPRNJO7.mjs
clapton-0.0.20 lib/clapton/javascripts/node_modules/@mswjs/interceptors/lib/browser/chunk-XVPRNJO7.mjs
clapton-0.0.19 lib/clapton/javascripts/node_modules/@mswjs/interceptors/lib/browser/chunk-XVPRNJO7.mjs
clapton-0.0.18 lib/clapton/javascripts/node_modules/@mswjs/interceptors/lib/browser/chunk-XVPRNJO7.mjs
clapton-0.0.17 lib/clapton/javascripts/node_modules/@mswjs/interceptors/lib/browser/chunk-XVPRNJO7.mjs
clapton-0.0.16 lib/clapton/javascripts/node_modules/@mswjs/interceptors/lib/browser/chunk-XVPRNJO7.mjs
clapton-0.0.15 lib/clapton/javascripts/node_modules/@mswjs/interceptors/lib/browser/chunk-XVPRNJO7.mjs
clapton-0.0.14 lib/clapton/javascripts/node_modules/@mswjs/interceptors/lib/browser/chunk-XVPRNJO7.mjs
clapton-0.0.13 lib/clapton/javascripts/node_modules/@mswjs/interceptors/lib/browser/chunk-XVPRNJO7.mjs
clapton-0.0.12 lib/clapton/javascripts/node_modules/@mswjs/interceptors/lib/browser/chunk-XVPRNJO7.mjs
clapton-0.0.11 lib/clapton/javascripts/node_modules/@mswjs/interceptors/lib/browser/chunk-XVPRNJO7.mjs
clapton-0.0.10 lib/clapton/javascripts/node_modules/@mswjs/interceptors/lib/browser/chunk-XVPRNJO7.mjs
clapton-0.0.9 lib/clapton/javascripts/node_modules/@mswjs/interceptors/lib/browser/chunk-XVPRNJO7.mjs
clapton-0.0.8 lib/clapton/javascripts/node_modules/@mswjs/interceptors/lib/browser/chunk-XVPRNJO7.mjs
clapton-0.0.7 lib/clapton/javascripts/node_modules/@mswjs/interceptors/lib/browser/chunk-XVPRNJO7.mjs