Fix json escape issue run with payload#9303
Open
Anzure wants to merge 1 commit into
Open
Conversation
Contributor
🔒 AI Validation PendingThis PR is from an external contributor. AI validation will be performed after manual review by a maintainer. Maintainers: Add the |
1 similar comment
Contributor
🔒 AI Validation PendingThis PR is from an external contributor. AI validation will be performed after manual review by a maintainer. Maintainers: Add the |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR targets the “run with payload” flow in designer-v2 to prevent JSON payloads from being double-escaped when triggering a workflow run.
Changes:
- Adds JSON body parsing before submitting the payload from the popover.
- Widens the
PayloadData.bodytype fromstringtounknownto allow non-string bodies to be passed through.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| libs/designer-v2/src/lib/ui/FloatingRunButton/payloadPopover.tsx | Attempts to parse JSON strings into objects/arrays before calling onSubmit to avoid double-escaping. |
| libs/designer-v2/src/lib/ui/FloatingRunButton/index.tsx | Updates the payload type to allow non-string body values. |
Comment on lines
110
to
+114
| const onRunClick = useCallback(() => { | ||
| // Parse a JSON object/array body so the HTTP client serializes it exactly once. | ||
| // Sending the raw string would let the client JSON.stringify it again, double-escaping the payload. | ||
| let body: unknown = bodyValue; | ||
| if (typeof bodyValue === 'string') { |
Comment on lines
47
to
52
| export type PayloadData = { | ||
| method?: string; | ||
| headers?: Record<string, string>; | ||
| queries?: Record<string, string>; | ||
| body?: string; | ||
| body?: unknown; | ||
| }; |
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Commit Type
Risk Level
What & Why
Impact of Change
Test Plan
Contributors
@Anzure
Screenshots/Videos