diff --git a/postcode_lookup/endpoints.py b/postcode_lookup/endpoints.py index 99ee92e..57b4e5e 100644 --- a/postcode_lookup/endpoints.py +++ b/postcode_lookup/endpoints.py @@ -101,8 +101,9 @@ async def base_uprn_endpoint(request: Request, backend=None): ).get_uprn(uprn) except InvalidUPRNException: return RedirectResponse( - request.url_for(backend.URL_PREFIX + "_postcode_form_en") - + "?invalid-uprn=1" + request.url_for( + backend.URL_PREFIX + "_postcode_form_en" + ).include_query_params(**{"invalid-uprn": 1}) ) context = results_context(api_response) context["request"] = request