mock-fried 1.0.2 → 1.0.4

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.
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.0.0"
6
6
  },
7
- "version": "1.0.2",
7
+ "version": "1.0.4",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -1,4 +1,5 @@
1
- import { defineEventHandler, getQuery, readBody, createError, getRequestURL } from "h3";
1
+ import { defineEventHandler, readBody, createError } from "h3";
2
+ import { parseQuery } from "ufo";
2
3
  import { useRuntimeConfig } from "#imports";
3
4
  import { readFileSync } from "node:fs";
4
5
  import yaml from "js-yaml";
@@ -290,13 +291,15 @@ function handleClientPackageRequest(pkg, generator, cursorManager, pageManager,
290
291
  export default defineEventHandler(async (event) => {
291
292
  const config = useRuntimeConfig(event);
292
293
  const mockConfig = config.mock;
293
- const requestUrl = getRequestURL(event);
294
294
  const prefix = mockConfig?.prefix || "/mock";
295
- let path = requestUrl.pathname;
295
+ const fullPath = event.path;
296
+ const queryIndex = fullPath.indexOf("?");
297
+ let path = queryIndex >= 0 ? fullPath.substring(0, queryIndex) : fullPath;
298
+ const queryString = queryIndex >= 0 ? fullPath.substring(queryIndex + 1) : "";
296
299
  if (path.startsWith(prefix)) {
297
300
  path = path.substring(prefix.length) || "/";
298
301
  }
299
- const query = getQuery(event);
302
+ const query = parseQuery(queryString);
300
303
  let body;
301
304
  if (event.method !== "GET" && event.method !== "HEAD") {
302
305
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mock-fried",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Nuxt3 Mock API Module - OpenAPI & Protobuf RPC Mock Server",
5
5
  "repository": {
6
6
  "type": "git",