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

Batch request URL encoding issue #910

Open
rahul7720 opened this issue Jul 22, 2023 · 0 comments
Open

Batch request URL encoding issue #910

rahul7720 opened this issue Jul 22, 2023 · 0 comments

Comments

@rahul7720
Copy link

Describe the bug
When using Simple.OData.Client to make batch requests, it appears that special characters in the URL are encoded (i.e., ' is encoded to %27). However, this causes an Internal Server Error (HTTP 500) in ASP.NET Core 7 OData, which seems unable to correctly decode these URLs in the batch request body.

To Reproduce
Steps to reproduce the behavior:

  • Create a batch request using Simple.OData.Client.
  • Include a request in the batch that contains a URL with special characters (e.g., ../products('AK47')).
  • Observe that the URL in the batch request body is URL-encoded (e.g., ../products(%27AK47%27)).
  • Send the batch request to an ASP.NET Core 7 OData service.
  • The server responds with an Internal Server Error.

Expected behavior

  • I expected the server to correctly process the batch request. In other words, the URL encoding should not cause any problems, as the server should automatically decode these URLs.

Generated batch request body:

--batch_7e31c0f6-cdc1-4df4-aa77-57acb2733d3c
Content-Type: multipart/mixed; boundary=changeset_5f14409d-84cc-4ece-b3c7-1d7227af2b62

--changeset_5f14409d-84cc-4ece-b3c7-1d7227af2b62
Content-Type: application/http
Content-Transfer-Encoding: binary
Content-ID: 1

GET https://localhost:44324/odata/products(%27AK47%27) HTTP/1.1
If-Match: *

--changeset_5f14409d-84cc-4ece-b3c7-1d7227af2b62--
--batch_7e31c0f6-cdc1-4df4-aa77-57acb2733d3c--

Environment

Simple.OData.Client Version: 6.01
ASP.NET Core Version: 7.0.0
OData Version: 8.2.0

Additional context
It seems the URL encoding issue only arises when special characters are present in the URLs within the batch request body. Single requests work as expected, and batch requests without special characters in the URLs also work as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant