microsoft / dev-proxy

Dev Proxy is an API simulator that helps you effortlessly test your app beyond the happy path.
https://aka.ms/devproxy
MIT License
471 stars 56 forks source link

[BUG]: Unexpected / between baseUrl and action in CRUD API plugin #822

Closed waldekmastykarz closed 2 months ago

waldekmastykarz commented 2 months ago

Description

CRUD API plugin adds unexpected / between the baseUrl and action URL

Expected behaviour

http://api.northwind.com/orders?country={country}

Actual behaviour

http://api.northwind.com/orders/?country={country}

Steps to reproduce

{
  "$schema": "https://raw.githubusercontent.com/microsoft/dev-proxy/main/schemas/v0.20.0/crudapiplugin.schema.json",
  "baseUrl": "http://api.northwind.com/orders",
  "auth": "none",
  "dataFile": "orders-data.json",
  "actions": [
    {
      "action": "getAll"
    },
    // Find orders by customer name
    {
      "action": "getMany",
      "url": "?customer={customer}",
      "query": "$.[?(@.ShipName == '{customer}')]"
    },
    // Find orders by country
    {
      "action": "getMany",
      "url": "?country={country}",
      "query": "$.[?(@.ShipCountry == '{country}')]"
    },
    // Get specific order by ID
    {
      "action": "getOne",
      "url": "/{order-id}",
      "query": "$.[?(@.OrderID == {order-id})]"
    },
    {
      "action": "create"
    },
    {
      "action": "merge",
      "url": "/{order-id}",
      "query": "$.[?(@.OrderID == {order-id})]"
    },
    {
      "action": "delete",
      "url": "/{order-id}",
      "query": "$.[?(@.OrderID == {order-id})]"
    }
  ]
}

Dev Proxy Version

latest from main

Operating system (environment)

macOS

Shell

zsh

Configuration file

See above

Additional Info

No response