Skip to content

Feature/copy as curl#1935

Merged
255kb merged 2 commits intomainfrom
feature/copy-as-curl
Nov 10, 2025
Merged

Feature/copy as curl#1935
255kb merged 2 commits intomainfrom
feature/copy-as-curl

Conversation

@255kb
Copy link
Member

@255kb 255kb commented Nov 10, 2025

Technical implementation details

Checklist

  • data migration added (@mockoon/commons)
  • commons lib tests added (@mockoon/commons)
  • commons-server lib tests added (@mockoon/commons-server)
  • CLI tests added (@mockoon/cli)
  • desktop UI automated tests added (@mockoon/app)

Closes #{issue_number}

Copilot AI review requested due to automatic review settings November 10, 2025 10:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds "Copy as cURL" functionality to environment logs, allowing users to copy HTTP requests as executable cURL commands. The implementation includes a new CurlCommandBuilder class that constructs properly formatted cURL commands with support for compression detection via the --compressed flag.

Key changes:

  • New CurlCommandBuilder library for constructing cURL commands with proper escaping and formatting
  • Added bodyUnformatted field to environment logs to preserve the original request body for cURL generation
  • Extended dropdown menu component to support dynamic labels and hidden items based on observables
  • Comprehensive test coverage including compression handling scenarios

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/app/src/renderer/app/libs/curl-command-builder.lib.ts New builder class for constructing cURL commands with compression detection and proper escaping
packages/app/src/renderer/app/services/environments.service.ts Implements copyLogAsCurl method to generate and copy cURL commands to clipboard
packages/app/src/renderer/app/models/environment-logs.model.ts Adds bodyUnformatted field to preserve original request body
packages/app/src/renderer/app/services/data.service.ts Updates log creation to store unformatted request body
packages/app/src/renderer/app/components/environment-logs/environment-logs.component.ts Adds dropdown menu items for copying as cURL (localhost and cloud versions)
packages/app/src/renderer/app/components/dropdown-menu/dropdown-menu.component.ts Extends dropdown menu to support function-based labels and hidden$ observables
packages/app/src/renderer/app/components/dropdown-menu/dropdown-menu.component.html Updates template to handle dynamic labels and hidden items
packages/app/test/specs/environment-logs.spec.ts Adds comprehensive tests for cURL copy functionality including compression scenarios
packages/app/test/libs/utils.ts Adds COPY_AS_CURL action to dropdown menu enum
packages/app/test/libs/http.ts Improves body handling to avoid sending "{}" for empty bodies
packages/app/test/libs/environments-logs.ts Adds helper method to click copy as cURL button in tests

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@255kb 255kb force-pushed the feature/copy-as-curl branch 3 times, most recently from f2eb953 to 6179e73 Compare November 10, 2025 12:35
Remove test that makes the pipeline fail on GitHub Actions only (no idea why)
@255kb 255kb force-pushed the feature/copy-as-curl branch from 9427fda to a6a98db Compare November 10, 2025 13:47
@255kb 255kb merged commit 601496b into main Nov 10, 2025
15 checks passed
@255kb 255kb deleted the feature/copy-as-curl branch November 11, 2025 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants