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

Incorrect url definition in Templates\ODataPostManTests.tpl for POST request #301

Closed
KishB opened this issue Jan 12, 2023 · 0 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@KishB
Copy link

KishB commented Jan 12, 2023

Issue:

When \Templates\ODataPostManTests.tpl is used to generate the POST request, the url definition is incorrect and generates this in Postman (this screenshot shows the structure Supplier, but it fails for any structure):
image

When executing the generated test, Postman throws the error:
image

To reproduce
Run codegen against the above template, make sure that the POST request for the structure is enabled.

Expected behavior
The correct url should look like this:
image

Fix:

In the POST section of the template, the url definition is currently this:
"url": {
"raw": "{{ServerBaseUri}}/{{ODataPath}}/v{{ApiVersion}}/Suppliers",
"host": [
"{{ODataPath}}",
"v{{ApiVersion}}",

"{{ServerBaseUri}}"
],
"path": [
"Suppliers"
]
}

It should be this (the bolded lines above are moved from the host section to the path section):
"url": {
"raw": "{{ServerBaseUri}}/{{ODataPath}}/v{{ApiVersion}}/Customers(Custno=123)",
"host": [
"{{ServerBaseUri}}"
],
"path": [
"{{ODataPath}}",
"v{{ApiVersion}}",

"Customers(Custno=123)"
]
}

I've tested the above modification and it no longer throws the protocol error and it properly sends the request to the endpoint. This behavior is only in the POST request, all other requests appear to have correct url host and path definitions.

@KishB KishB added the bug Something isn't working label Jan 12, 2023
hippiehunter added a commit that referenced this issue Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants