codebase-snapshot 0.17.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { createServer, buildTools, GENERATOR_VERSION } from './chunk-PDLN24ZZ.js';
1
+ import { createServer, buildTools, GENERATOR_VERSION } from './chunk-RTWSGQ3U.js';
2
2
  import * as http from 'http';
3
3
  import * as crypto from 'crypto';
4
4
 
@@ -68,6 +68,7 @@ async function startHttpTransport(options) {
68
68
  noteRequest(request);
69
69
  const send = (status, body, extra = {}) => {
70
70
  const text = typeof body === "string" ? body : JSON.stringify(body);
71
+ if (status >= 400 && status < 500 && status !== 429) metrics.refused += 1;
71
72
  response.writeHead(status, {
72
73
  "content-type": typeof body === "string" ? "text/plain; charset=utf-8" : "application/json",
73
74
  "content-length": Buffer.byteLength(text, "utf8"),
@@ -79,7 +80,6 @@ async function startHttpTransport(options) {
79
80
  const origin = typeof request.headers.origin === "string" ? request.headers.origin : void 0;
80
81
  const allowed = allowedOrigin(origin);
81
82
  if (origin !== void 0 && allowed === null) {
82
- metrics.refused += 1;
83
83
  send(403, { error: "origin not allowed" });
84
84
  return;
85
85
  }
@@ -117,7 +117,7 @@ async function startHttpTransport(options) {
117
117
  "# HELP snapshot_requests_total HTTP requests received.",
118
118
  "# TYPE snapshot_requests_total counter",
119
119
  "snapshot_requests_total " + metrics.requests,
120
- "# HELP snapshot_requests_refused_total Requests refused before dispatch.",
120
+ "# HELP snapshot_requests_refused_total Requests refused before dispatch (4xx other than 429).",
121
121
  "# TYPE snapshot_requests_refused_total counter",
122
122
  "snapshot_requests_refused_total " + metrics.refused,
123
123
  "# HELP snapshot_requests_rate_limited_total Requests rejected by the rate limit.",