Repository: localstack/localstack

Issue:
bug: API Gateway base-path-mappings don't work for the (none) path
### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

When creating base-path-mappings on an API Gateway, there is a special `(none)` path when you don't specify a path during creation. Localstack stores this as `basePath: "(none)"` internally.
When you query to get the base paths, the URLs are escaped by the client (verified in both awscli and terraform) so the basePath is sent as `%28none%29` in the url.
Localstack doesn't appear to be decoding urls and when you attempt to get-base-path-mapping it fails in a string comparison of `(none)` to `%28none%29`.

```shell
> aws --endpoint-url=http://localhost:4566 apigateway get-base-path-mapping --domain-name example.com --base-path "(none)"

An error occurred (NotFoundException) when calling the GetBasePathMapping operation: Base path mapping not found: %28none%29
```

### Expected Behavior

When you attempt to get-base-path-mappings after creating one with the (none) path, it succeeds and returns the mapping.

```
> aws --endpoint-url=http://localhost:4566 apigateway get-base-path-mapping --domain-name example.com --base-path "(none)"

{
    "basePath": "(none)",
    "restApiId": "uyy4c3dsho",
    "stage": "dev"
}
```


### How are you starting LocalStack?

With the `localstack` script

### Steps To Reproduce

#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)

    make start

#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

    awslocal apigateway create-rest-api --name "testgw"
    awslocal apigateway create-base-path-mapping --domain-name example.com --rest-api-id <from output above> --stage dev
    awslocal apigateway get-base-path-mapping --domain-name example.com --base-path "(none)"



### Environment

```markdown
- OS: fedora 34
- LocalStack: latest
```


### Anything else?

https://docs.aws.amazon.com/apigateway/api-reference/link-relation/basepathmapping-by-base-path/


Discussion:

Resolving patch:
diff --git a/localstack/services/apigateway/helpers.py b/localstack/services/apigateway/helpers.py
--- a/localstack/services/apigateway/helpers.py
+++ b/localstack/services/apigateway/helpers.py
@@ -443,6 +443,7 @@ def delete_base_path_mapping(path):
 
 
 def handle_base_path_mappings(method, path, data, headers):
+    path = urlparse.unquote(path)
     if method == "GET":
         return get_base_path_mapping(path)
     if method == "POST":


Test patch:
diff --git a/tests/integration/test_api_gateway.py b/tests/integration/test_api_gateway.py
--- a/tests/integration/test_api_gateway.py
+++ b/tests/integration/test_api_gateway.py
@@ -842,6 +842,59 @@ def test_base_path_mapping(self):
         with self.assertRaises(Exception):
             client.delete_base_path_mapping(domainName=domain_name, basePath=base_path)
 
+    def test_base_path_mapping_root(self):
+        client = aws_stack.connect_to_service("apigateway")
+        response = client.create_rest_api(name="my_api2", description="this is my api")
+        rest_api_id = response["id"]
+
+        # CREATE
+        domain_name = "domain2.example.com"
+        client.create_domain_name(domainName=domain_name)
+        root_res_id = client.get_resources(restApiId=rest_api_id)["items"][0]["id"]
+        res_id = client.create_resource(
+            restApiId=rest_api_id, parentId=root_res_id, pathPart="path"
+        )["id"]
+        client.put_method(
+            restApiId=rest_api_id, resourceId=res_id, httpMethod="GET", authorizationType="NONE"
+        )
+        client.put_integration(
+            restApiId=rest_api_id, resourceId=res_id, httpMethod="GET", type="MOCK"
+        )
+        depl_id = client.create_deployment(restApiId=rest_api_id)["id"]
+        client.create_stage(restApiId=rest_api_id, deploymentId=depl_id, stageName="dev")
+        result = client.create_base_path_mapping(
+            domainName=domain_name,
+            basePath="",
+            restApiId=rest_api_id,
+            stage="dev",
+        )
+        self.assertIn(result["ResponseMetadata"]["HTTPStatusCode"], [200, 201])
+
+        base_path = "(none)"
+        # LIST
+        result = client.get_base_path_mappings(domainName=domain_name)
+        self.assertEqual(200, result["ResponseMetadata"]["HTTPStatusCode"])
+        expected = {"basePath": "(none)", "restApiId": rest_api_id, "stage": "dev"}
+        self.assertEqual([expected], result["items"])
+
+        # GET
+        result = client.get_base_path_mapping(domainName=domain_name, basePath=base_path)
+        self.assertEqual(200, result["ResponseMetadata"]["HTTPStatusCode"])
+        self.assertEqual(expected, select_attributes(result, ["basePath", "restApiId", "stage"]))
+
+        # UPDATE
+        result = client.update_base_path_mapping(
+            domainName=domain_name, basePath=base_path, patchOperations=[]
+        )
+        self.assertEqual(200, result["ResponseMetadata"]["HTTPStatusCode"])
+
+        # DELETE
+        client.delete_base_path_mapping(domainName=domain_name, basePath=base_path)
+        with self.assertRaises(Exception):
+            client.get_base_path_mapping(domainName=domain_name, basePath=base_path)
+        with self.assertRaises(Exception):
+            client.delete_base_path_mapping(domainName=domain_name, basePath=base_path)
+
     def test_api_account(self):
         client = aws_stack.connect_to_service("apigateway")
         response = client.create_rest_api(name="my_api", description="test 123")