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

meta the arguments a bit for GET vs other request types #640

Merged
merged 2 commits into from
May 2, 2024

Conversation

jmartin-tech
Copy link
Collaborator

@jmartin-tech jmartin-tech commented Apr 29, 2024

Fix #557

Tested example:

REST_API_KEY="fake" ./garak_debug.py -m rest --generator_option_file garak/resources/rest/restdemo.json -p encoding.InjectBase16

Changing restdemo.json method types using garak/resources/rest/restserv.py as server side:
post:

127.0.0.1 - - [29/Apr/2024 15:53:55] "POST /endpoint HTTP/1.1" 200 -
values CombinedMultiDict([ImmutableMultiDict([]), ImmutableMultiDict([])])
data b'{"text": "32373561303231626266623634383965353464343731383939663764623964313636336663363935656332666532613263343533386161626636353166643066"}'
headers Host: localhost:37176
User-Agent: python-requests/2.31.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
X-Authorization: fake
Content-Length: 140

get:

127.0.0.1 - - [29/Apr/2024 15:54:19] "GET /endpoint?{"text":%20"32373561303231626266623634383965353464343731383939663764623964313636336663363935656332666532613263343533386161626636353166643066"} HTTP/1.1" 200 -
values CombinedMultiDict([ImmutableMultiDict([]), ImmutableMultiDict([])])
data b'{"text": "32373561303231626266623634383965353464343731383939663764623964313636336663363935656332666532613263343533386161626636353166643066"}'
headers Host: localhost:37176
User-Agent: python-requests/2.31.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
X-Authorization: fake
Content-Length: 140

This probably deserves better testing at some point.

Signed-off-by: Jeffrey Martin <jemartin@nvidia.com>
Signed-off-by: Jeffrey Martin <jemartin@nvidia.com>
@leondz leondz added the generators Interfaces with LLMs label Apr 30, 2024
Copy link
Owner

@leondz leondz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. Thanks for also updating restdemo.json, good catch

@leondz leondz merged commit bb6eac0 into leondz:main May 2, 2024
4 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators May 2, 2024
@jmartin-tech jmartin-tech deleted the fix/rest-get-params branch May 2, 2024 18:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
generators Interfaces with LLMs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

REST generator does not handle GET requests properly
2 participants