Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for random data placeholders in request body #3608

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

RikhiSingh
Copy link

@RikhiSingh RikhiSingh commented Dec 7, 2024

Description

feat: Random Data Placeholders for Request Body

fixes: #3610
fixes : #620

Changes Introduced

  • Integrated functionality to replace placeholders in request bodies with dynamically generated random data.
  • Added utility functions in variable-replacer.js to support a variety of random data formats (UUIDs, timestamps, IPs, etc.).
  • Updated RequestTabPanel to preprocess request bodies and replace placeholders before sending requests.

Benefits

  • Enhances API testing by allowing dynamic data in request payloads.
  • Supports various placeholder types, improving test coverage and flexibility.

Testing

  • Verified functionality by sending requests with different placeholders and checking if the data was correctly replaced.

Notes

  • Placeholder syntax follows the format "$". A comprehensive list of supported placeholders is available in variable-replacer.js.

Contribution Checklist:

  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

image

- Introduced a feature that allows replacing placeholders in the request body with random data for testing purposes.
- Added `replacePlaceholders` function in `utils/common/variable-replacer.js` to generate and replace placeholders like `$guid`, `$timestamp`, `$randomInt`, etc.
- Modified `RequestTabPanel` to integrate the placeholder replacement logic before sending requests.
- Enhanced testing capabilities by supporting a wide range of placeholder types for dynamic data generation.
@RikhiSingh RikhiSingh changed the title Feature: Add support for random data placeholders in request body feat: Add support for random data placeholders in request body Dec 7, 2024
@RikhiSingh RikhiSingh force-pushed the feature/random-data-placeholders branch from a31dfb6 to 979396d Compare December 7, 2024 12:16
@nikischin
Copy link

How is this different from #3609? Honestly, the syntax of #3609 seems more straightforward to me.

@RikhiSingh
Copy link
Author

RikhiSingh commented Jan 2, 2025

This is done on the front-end, so it's calculation is done by the client. The other one that you quoted is done on the backend, and most importantly, this is more lengthier because it supports more placeholders.

#3609 supports about 40ish mine supports over 100!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add dynamic variable support to bruno Random variable in json body
2 participants