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

Invalid rest path segments for the URL contains encoded slash #7430

Open
TharmiganK opened this issue Dec 2, 2024 · 0 comments
Open

Invalid rest path segments for the URL contains encoded slash #7430

TharmiganK opened this issue Dec 2, 2024 · 0 comments
Labels
module/http Team/PCM Protocol connector packages related issues Type/Bug

Comments

@TharmiganK
Copy link
Contributor

Description

When a ballerina service is defined with the rest path parameter and invoked via a URL which contains (properly encoded)slash inside a the path segment, the array value obtained as the path parameter returns invalid result.

Steps to Reproduce

Simple reproducible code:

import ballerina/http;
import ballerina/io;

service /api on new http:Listener(9090) {
    resource function post [string... pathSegments]() {
        io:println("Path segments: ", pathSegments);
    }
}

Make a cURL request (Please note that the 4th path segment has encoded slash):

$ curl -v "http://localhost:9090/api/path1/path2/path3%2Fsegment/path4" -X POST

The printed path segments: ["path1","path2","path3","segment","path4"]
The expected path segments: ["path1","path2","path3/segment","path4"] - path3/segment should be a single path segment

Version

Ballerina SwanLake Update 10

Environment Details (with versions)

No response

@TharmiganK TharmiganK added Type/Bug module/http Team/PCM Protocol connector packages related issues labels Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/http Team/PCM Protocol connector packages related issues Type/Bug
Projects
None yet
Development

No branches or pull requests

1 participant