Skip to content

Add -ContentType Argument Completer for Invoke-RestMethod & Invoke-WebRequest cmdlets #24924

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

ArmaanMcleod
Copy link
Contributor

PR Summary

Added ContentTypeArgumentCompleter for Invoke-RestMethod & Invoke-WebRequest cmdlets when using -ContentType parameter.

This completer uses reflection with .NET Media MIME types in System.Net.Mime.MediaTypeNames. Specifically just kept in the Application and Text media types, although we can add/remove these depending on ones which make sense.

I also used CompletionCompleters.GetMatchingResults so quotes are also handled.

Included tests to for the tab completion scenarios.

PR Context

Fixes #24917

PR Checklist

@microsoft-github-policy-service microsoft-github-policy-service bot added the Review - Needed The PR is being reviewed label Feb 10, 2025
@iSazonov
Copy link
Collaborator

I suggest to close the PR and wait WG conclusion in related issue. As tempting as this completer is, I doubt they'll approve.

@microsoft-github-policy-service microsoft-github-policy-service bot removed the Review - Needed The PR is being reviewed label Feb 10, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added the Review - Needed The PR is being reviewed label Feb 17, 2025
@ArmaanMcleod ArmaanMcleod reopened this Feb 28, 2025
@iSazonov iSazonov added WG-Interactive-IntelliSense tab completion WG-NeedsReview Needs a review by the labeled Working Group labels Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Review - Needed The PR is being reviewed WG-Interactive-IntelliSense tab completion WG-NeedsReview Needs a review by the labeled Working Group
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invoke-RestMethod & Invoke-WebRequest should have tab completion for -ContentType
2 participants