Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Placeholder value does not correctly replace when the placeholder is defined between round braces #1512

Open
PratikPatel-Mtech opened this issue Sep 1, 2021 · 2 comments
Assignees
Labels
bug Identified as a potential bug needs validation Issue has not been replicated or verified yet

Comments

@PratikPatel-Mtech
Copy link

PratikPatel-Mtech commented Sep 1, 2021

Expected Behavior

The specified placeholder variable value should be replaced within the Downstream URI provided in the UpstreamPathTemplate and DownStreamPathTemplate. For instance,

Route Configurations:

{
  "DownstreamPathTemplate": "/api/subscriptions({subscriptionId})/updates",
  "UpstreamPathTemplate": "/v1/subscriptions({subscriptionId})/updates",
  "UpstreamHttpMethod": [ "Get" ],
  "DownstreamScheme": "http",
  "DownstreamHostAndPorts": [
    { "Host": "localhost", "Port": 50110 }
  ]
}

When the request URI is http://localhost:5001/v1/subscriptions(123)/updates
Then the downstream request URI should be http://localhost:50110/api/subscriptions(123)/updates

Actual Behavior

It's adding extra round braces ) in the Downstream request. It's a clear issue of replacing placeholder variables.

When the request URI is http://localhost:5001/v1/subscriptions(123)/updates
Then the downstream request URI is http://localhost:50110/api/subscriptions(123))/updates

Steps to Reproduce the Problem

  1. Add a route with the placeholder within the round braces
  2. Get parameter value in the downstream. Observed the value received at the downstream application.

NOTE: An issue is not with specific round braces. It reproduces with any other routes where the placeholder does not exactly(eg. /{id}/ ) provide between slashes.

Specifications

  • Version: 17.0.0
  • Platform: .NET 5
@ks1990cn
Copy link
Contributor

ks1990cn commented Oct 26, 2023

@PratikPatel-Mtech Looks like this is from Microsoft aspnet inbuilt thing for Placeholder Value comming through HttpContext.

But its really strange to note that from swagger for these routes we get right result.

probably swagger can implement this as it has UI for input, but from postman its tough to find any specific pattern. Example from swagger /su((!))/row is valid for route /su({string}/row

@raman-m @ggnaegi Any thoughts on this?

Screenshot (5)

@raman-m raman-m added bug Identified as a potential bug needs validation Issue has not been replicated or verified yet labels Oct 30, 2023
@raman-m
Copy link
Member

raman-m commented Oct 30, 2023

@PratikPatel-Mtech Hi Pratik,
Thanks for reporting!

We will check this... Too busy...
Do you have intention to write unit tests or acceptance one in your fork?
Please, fork Ocelot repo and in some feature branch you can write tests...

By this way you will confirm that the bug still exists in current version 20.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Identified as a potential bug needs validation Issue has not been replicated or verified yet
Projects
None yet
Development

No branches or pull requests

3 participants