Skip to content

Commit

Permalink
GeneralNameReplacer correctly handles bytes bodies (#13710)
Browse files Browse the repository at this point in the history
  • Loading branch information
chlowell authored Sep 17, 2020
1 parent 8ceb527 commit 63ec7ee
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
import six

from .utilities import is_text_payload, is_json_payload

@@ -177,7 +178,7 @@ def process_request(self, request):
request.uri = request.uri.replace(old, new)

if is_text_payload(request) and request.body:
body = str(request.body)
body = six.ensure_str(request.body)
if old in body:
request.body = body.replace(old, new)

0 comments on commit 63ec7ee

Please sign in to comment.