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

REST API Calls (GET) fail when "/" (forward slash) is part of the query (key) string #8642

Open
adas98012 opened this issue Jun 29, 2022 · 0 comments
Labels
k/bug Something isn't working t/gql-services

Comments

@adas98012
Copy link
Contributor

Version Information

Server Version: 2.8.1

Environment

Cloud

What is the expected behaviour?

RESTified endpoints should support and correctly parse strings with "/" in it.

Keywords

REST API, Query Param

What is the current behaviour?

When a "/" is part of the query param in a REST (GET) API, it results in the following error messages:

Error Message: The endpoint does not exist
Error Status code: 404

How to reproduce the issue?

  1. Create a Hasura cloud project and add a database.
  2. Create and track table with a String field type:
CREATE TABLE api_test 
(
  id int NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, 
  locationKey TEXT,
 locationName TEXT
);
  1. INSERT Some test values into the table:
INSERT INTO api_test(locationKey, locationName) values ('us-west-1', 'US West #1');
INSERT INTO api_test(locationKey, locationName) values ('us-west-2', 'US West #2');
INSERT INTO api_test(locationKey, locationName) values ('us-east/3', 'US East #3');  -- locationKey has a slash

  1. Create a RESTified Graphql endpoint using this table with an argument for locationKey, for example using this query:
query MyQuery2 ($loc_id: String!) {
  api_test(where: {locationKey: {_eq: $loc_id}}) {
    id
    locationKey
    locationName
  }
}
  1. Configure the endpoint to accept GET requests and test it with loc_id ("us-east/3").

Screen Shot 2022-06-28 at 5 35 01 PM

  1. Run the Request. Observe the following error:

Screen Shot 2022-06-28 at 5 40 05 PM

Any possible solutions?

The loc_id is parsed correctly if passed in the request body of a POST API call.

@adas98012 adas98012 added the k/bug Something isn't working label Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
k/bug Something isn't working t/gql-services
Projects
None yet
Development

No branches or pull requests

1 participant