Repository: getmoto/moto (python)

Issue:
The CreateHostedZone response for Route53 does not match the behavior of AWS
## Reporting Bugs

I'm using localstack, which implements its route53 mock service using moto.

The `CreateHostedZone` operation returns a response that misses some info compared to an actual AWS response. In particular, it misses the `Location` header, which is where official AWS SDKs are reading the location.

See https://github.com/localstack/localstack/pull/5639#issuecomment-1064527918 for a detailed analysis submitted to localstack a while ago


Pull request description:
Route53: create_hosted_zone() now returns the Location
Fixes #6464 

Patch:
diff --git a/moto/route53/responses.py b/moto/route53/responses.py
index 647166fd1..4c43eddf3 100644
--- a/moto/route53/responses.py
+++ b/moto/route53/responses.py
@@ -81,6 +81,9 @@ class Route53(BaseResponse):
                 delegation_set_id=delegation_set_id,
             )
             template = Template(CREATE_HOSTED_ZONE_RESPONSE)
+            headers = {
+                "Location": f"https://route53.amazonaws.com/2013-04-01/hostedzone/{new_zone.id}"
+            }
             return 201, headers, template.render(zone=new_zone)
 
         elif request.method == "GET":


Test patch:
diff --git a/tests/test_route53/test_route53.py b/tests/test_route53/test_route53.py
index 03fc53161..67538b09b 100644
--- a/tests/test_route53/test_route53.py
+++ b/tests/test_route53/test_route53.py
@@ -5,8 +5,9 @@ import sure  # noqa # pylint: disable=unused-import
 
 import botocore
 import pytest
+import requests
 
-from moto import mock_ec2, mock_route53
+from moto import mock_ec2, mock_route53, settings
 
 
 @mock_route53
@@ -28,6 +29,10 @@ def test_create_hosted_zone():
     delegation["NameServers"].should.contain("ns-2050.awsdns-66.org")
     delegation["NameServers"].should.contain("ns-2051.awsdns-67.co.uk")
 
+    location = response["Location"]
+    if not settings.TEST_SERVER_MODE:
+        assert "<Name>testdns.aws.com.</Name>" in requests.get(location).text
+
 
 @mock_route53
 def test_list_hosted_zones():
@@ -481,7 +486,6 @@ def test_list_or_change_tags_for_resource_request():
 @mock_ec2
 @mock_route53
 def test_list_hosted_zones_by_name():
-
     # Create mock VPC so we can get a VPC ID
     ec2c = boto3.client("ec2", region_name="us-east-1")
     vpc_id = ec2c.create_vpc(CidrBlock="10.1.0.0/16").get("Vpc").get("VpcId")