Skip to content

Commit

Permalink
Correctly encode the audit log header to a URI component (#659)
Browse files Browse the repository at this point in the history
* Correctly encode the audit log header to a URI component

* Add test for encoding unicode audit log reason

---------

Co-authored-by: Mylo Fawcett <[email protected]>
  • Loading branch information
Lexedia and abitofevrything authored May 23, 2024
1 parent 7908853 commit 27b74b5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/src/http/request.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ abstract class HttpRequest {

Map<String, String> _getHeaders(Nyxx client) => {
userAgent: client.apiOptions.userAgent,
if (auditLogReason != null) xAuditLogReason: auditLogReason!,
if (auditLogReason != null) xAuditLogReason: Uri.encodeComponent(auditLogReason!),
if (authenticated) authorization: client.apiOptions.authorizationHeader,
...headers,
};
Expand Down
2 changes: 1 addition & 1 deletion test/integration/rest_integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ void main() {
);

await expectLater(
webhook.delete(),
webhook.delete(auditLogReason: 'Testing Unicode in audit log reason 😀'),
completes,
);
});
Expand Down

0 comments on commit 27b74b5

Please sign in to comment.