├── tests
├── TestFiles
│ ├── arq.txt
│ ├── InputData.json
│ ├── homem_aranha.jpg
│ ├── ClientCertificates
│ │ ├── badssl.com-client.p12
│ │ └── badssl.com-client-unencrypted-private-key.key
│ └── InputData1.json
├── Pororoca.Domain.Tests
│ ├── TestData
│ │ ├── testfilecontent1.json
│ │ ├── testfilecontent2.json
│ │ ├── pirate.gif
│ │ ├── multipartformdata
│ │ ├── InputData2.json
│ │ ├── EmptyEnvironment.pororoca_environment.json
│ │ ├── EmptyCollection.pororoca_collection.json
│ │ ├── TestEnvironment.postman_environment.json
│ │ └── OpenAPI
│ │ │ └── SHODAN-OPENAPI.json
│ ├── Features
│ │ ├── Common
│ │ │ ├── HttpVersionFormatterTests.cs
│ │ │ ├── HttpStatusCodeFormatterTests.cs
│ │ │ └── FileNameUtilsTests.cs
│ │ ├── Entities
│ │ │ └── Pororoca
│ │ │ │ ├── WebSockets
│ │ │ │ └── WebSocketMessageTypeExtensionsTests.cs
│ │ │ │ └── PororocaVariableTests.cs
│ │ └── ImportEnvironment
│ │ │ └── PororocaEnvironmentImporterTests.cs
│ └── TestFilesLoader.cs
├── Pororoca.TestServer
│ ├── TestFiles
│ │ ├── pirate.gif
│ │ └── ascii.txt
│ ├── Configurations
│ │ ├── SerilogConfiguration.cs
│ │ └── JsonConfiguration.cs
│ ├── Endpoints
│ │ ├── WebApplicationExtensions.cs
│ │ ├── WebSocketServerSideConnector.cs
│ │ └── MultipartResult.cs
│ ├── appsettings.Development.json
│ ├── appsettings.json
│ ├── Pororoca.TestServer.csproj
│ └── Properties
│ │ └── launchSettings.json
└── Pororoca.Test.Tests
│ ├── FactOnlyIfOSSupportsHttp2.cs
│ ├── FactOnlyIfOSSupportsHttp3.cs
│ ├── TestFilesLoader.cs
│ ├── Pororoca.Test.Tests.csproj
│ ├── PororocaTestLibraryLargeRepetitionTests.cs
│ └── PororocaTestLibraryClientCertificatesTests.cs
├── global.json
├── .github
├── FUNDING.yml
├── ISSUE_TEMPLATE
│ ├── feature_request.md
│ └── bug_report.md
├── workflows
│ └── pr-to-develop-wfw.yml
└── CODEOWNERS
├── pororoca.png
├── src
├── Pororoca.Desktop.Debian
│ ├── pororoca.sh
│ ├── pororoca_icon_16px.png
│ ├── pororoca_icon_32px.png
│ ├── pororoca_icon_48px.png
│ ├── pororoca_icon_64px.png
│ ├── pororoca_icon_1024px.png
│ ├── pororoca_icon_128px.png
│ ├── pororoca_icon_256px.png
│ ├── pororoca_icon_512px.png
│ ├── Pororoca.desktop
│ └── control
├── Pororoca.Desktop.MacOSX
│ ├── pororoca.icns
│ ├── icon_1024px.png
│ ├── Info.plist
│ └── generate_apple_icns.ps1
├── Pororoca.Desktop.WindowsInstaller
│ ├── Common
│ │ └── un.Utils.nsh
│ └── Plugins
│ │ ├── x86-ansi
│ │ ├── UAC.dll
│ │ └── StdUtils.dll
│ │ └── x86-unicode
│ │ ├── UAC.dll
│ │ └── StdUtils.dll
├── Pororoca.Desktop
│ ├── Assets
│ │ ├── pororoca_icon.ico
│ │ ├── Images
│ │ │ └── pororoca.png
│ │ └── Fonts
│ │ │ ├── Cabin-VariableFont_wdth,wght.ttf
│ │ │ └── Cabin-Italic-VariableFont_wdth,wght.ttf
│ ├── FodyWeavers.xml
│ ├── UITesting
│ │ ├── GlobalUsings.cs
│ │ ├── Robots
│ │ │ ├── BaseRobot.cs
│ │ │ ├── BaseNamedRobot.cs
│ │ │ ├── CollectionScopedAuthRobot.cs
│ │ │ ├── CollectionFolderRobot.cs
│ │ │ ├── CollectionRobot.cs
│ │ │ ├── EditableTextBlockRobot.cs
│ │ │ ├── CollectionScopedRequestHeadersRobot.cs
│ │ │ ├── ItemsTreeRobot.cs
│ │ │ ├── ExportEnvironmentRobot.cs
│ │ │ └── CollectionVariablesRobot.cs
│ │ ├── Tests
│ │ │ ├── HttpRequests
│ │ │ │ ├── PostEmpty.cs
│ │ │ │ ├── BearerAuth.cs
│ │ │ │ ├── GetJsonResponse.cs
│ │ │ │ ├── BasicAuth.cs
│ │ │ │ ├── GetBinaryResponse.cs
│ │ │ │ ├── GetTextResponse.cs
│ │ │ │ ├── PostJson.cs
│ │ │ │ ├── PostText.cs
│ │ │ │ ├── PostFile.cs
│ │ │ │ ├── Trailers.cs
│ │ │ │ ├── PostUrlEncoded.cs
│ │ │ │ ├── Headers.cs
│ │ │ │ ├── CaptureResponseJsonBodyValue.cs
│ │ │ │ ├── CaptureResponseXmlBodyValue.cs
│ │ │ │ └── CaptureResponseHeader.cs
│ │ │ └── TopMenuUITest.cs
│ │ ├── PororocaUITest.cs
│ │ └── PororocaUITestAssertions.cs
│ ├── Views
│ │ ├── WelcomeView.xaml.cs
│ │ ├── CollectionView.xaml.cs
│ │ ├── EnvironmentView.xaml.cs
│ │ ├── RequestAuthView.xaml.cs
│ │ ├── CollectionFolderView.xaml.cs
│ │ ├── CollectionsGroupView.xaml.cs
│ │ ├── ExportCollectionView.xaml.cs
│ │ ├── ExportEnvironmentView.xaml.cs
│ │ ├── CollectionVariablesView.xaml.cs
│ │ ├── CollectionScopedAuthView.xaml.cs
│ │ ├── CollectionScopedRequestHeadersView.xaml.cs
│ │ ├── ImportExportCurlWindow.xaml.cs
│ │ ├── UITestsRunnerWindow.xaml.cs
│ │ ├── MainWindow.xaml.cs
│ │ └── CollectionScopedAuthView.xaml
│ ├── HotKeys
│ │ ├── VariablesClipboardArea.cs
│ │ ├── FormDataParamsClipboardArea.cs
│ │ ├── HttpResponseCapturesClipboardArea.cs
│ │ ├── SimpleClipboardArea.cs
│ │ ├── KeyValueParamsClipboardArea.cs
│ │ └── Dialogs.cs
│ ├── Controls
│ │ ├── VariablesTableView.xaml.cs
│ │ ├── RequestHeadersTableView.xaml.cs
│ │ ├── ResponseHeadersTableView.xaml.cs
│ │ ├── IconButton.axaml.cs
│ │ └── EditableTextBlock.xaml.cs
│ ├── Styles
│ │ ├── Themes.xaml
│ │ ├── Fonts.xaml
│ │ └── SideBar.xaml
│ ├── ViewModels
│ │ ├── ViewModelBase.cs
│ │ ├── CollectionVariablesViewModel.cs
│ │ ├── CollectionScopedAuthViewModel.cs
│ │ ├── PageHolder.cs
│ │ ├── DataGrids
│ │ │ ├── KeyValueParamsDataGridViewModel.cs
│ │ │ ├── VariablesDataGridViewModel.cs
│ │ │ ├── RequestHeadersDataGridViewModel.cs
│ │ │ ├── KeyValueParamViewModel.cs
│ │ │ └── HttpResponseCapturesDataGridViewModel.cs
│ │ ├── WelcomeViewModel.cs
│ │ ├── CollectionScopedRequestHeadersViewModel.cs
│ │ ├── ExportCollectionViewModel.cs
│ │ ├── ExportEnvironmentViewModel.cs
│ │ ├── EditableTextBlockViewModel.cs
│ │ └── HttpRepetitionResultViewModel.cs
│ ├── ViewLocator.cs
│ ├── App.xaml.cs
│ ├── Converters
│ │ ├── ExportCollectionFormatConverters.cs
│ │ ├── ExportEnvironmentFormatConverters.cs
│ │ ├── RepetitionModeConverters.cs
│ │ ├── RepetitionInputDataTypeConverters.cs
│ │ ├── ClientCertificateTypeConverters.cs
│ │ ├── WebSocketMessageTypeConverters.cs
│ │ ├── WebSocketClientMessageContentModeConverters.cs
│ │ ├── WebSocketMessageRawContentSyntaxConverters.cs
│ │ ├── WebSocketConnectionOptionConverters.cs
│ │ ├── EnumMatchConverter.cs
│ │ ├── AuthModeConverters.cs
│ │ └── HttpRequestBodyModeConverters.cs
│ ├── Behaviors
│ │ ├── VariablesDataGridDropHandler.cs
│ │ ├── RequestHeadersDataGridDropHandler.cs
│ │ ├── FormDataParamsDataGridDropHandler.cs
│ │ ├── SubprotocolsDataGridDropHandler.cs
│ │ ├── UrlEncodedParamsDataGridDropHandler.cs
│ │ └── ResponseCapturesDataGridDropHandler.cs
│ ├── App.xaml
│ ├── Localization
│ │ └── TimeTextFormatter.cs
│ └── TextEditorConfig
│ │ └── PororocaVariableTextEditorCompletionData.cs
├── Pororoca.Domain
│ ├── InternalsExposer.cs
│ ├── Features
│ │ ├── Entities
│ │ │ ├── Pororoca
│ │ │ │ ├── WebSockets
│ │ │ │ │ ├── PororocaWebSocketMessageRawContentSyntax.cs
│ │ │ │ │ ├── PororocaWebSocketMessage.cs
│ │ │ │ │ ├── WebSocketMessageTypeExtensions.cs
│ │ │ │ │ ├── PororocaWebSocketCompressionOptions.cs
│ │ │ │ │ ├── PororocaWebSocketClientMessage.cs
│ │ │ │ │ └── PororocaWebSocketConnection.cs
│ │ │ │ ├── Http
│ │ │ │ │ ├── PororocaHttpRequestBodyGraphQl.cs
│ │ │ │ │ ├── PororocaHttpResponseValueCapture.cs
│ │ │ │ │ ├── PororocaHttpRequestFormDataParam.cs
│ │ │ │ │ └── PororocaHttpRequest.cs
│ │ │ │ ├── PororocaRequestAuthWindows.cs
│ │ │ │ ├── PororocaKeyValueParam.cs
│ │ │ │ ├── PororocaRequest.cs
│ │ │ │ ├── PororocaVariable.cs
│ │ │ │ ├── PororocaRequestAuthClientCertificate.cs
│ │ │ │ ├── PororocaEnvironment.cs
│ │ │ │ └── PororocaCollectionFolder.cs
│ │ │ ├── Postman
│ │ │ │ ├── PostmanRequestBodyFileAttachment.cs
│ │ │ │ ├── PostmanRequestBodyOptions.cs
│ │ │ │ ├── PostmanRequestBodyGraphQl.cs
│ │ │ │ ├── PostmanEnvironmentVariable.cs
│ │ │ │ ├── PostmanVariable.cs
│ │ │ │ ├── PostmanRequest.cs
│ │ │ │ ├── PostmanRequestBodyRawOptions.cs
│ │ │ │ ├── PostmanCollectionInfo.cs
│ │ │ │ ├── PostmanRequestUrl.cs
│ │ │ │ ├── PostmanCollectionItem.cs
│ │ │ │ ├── PostmanCollectionV21.cs
│ │ │ │ ├── PostmanEnvironment.cs
│ │ │ │ ├── PostmanRequestBodyFormDataParam.cs
│ │ │ │ ├── PostmanRequestBody.cs
│ │ │ │ └── LICENSE.txt
│ │ │ └── GitHub
│ │ │ │ └── GitHubGetReleaseResponse.cs
│ │ ├── Requester
│ │ │ ├── IPororocaHttpClientProvider.cs
│ │ │ └── IPororocaRequester.cs
│ │ ├── Common
│ │ │ ├── HttpStatusCodeFormatter.cs
│ │ │ ├── FileNameUtils.cs
│ │ │ ├── HttpVersionFormatter.cs
│ │ │ ├── System.Threading.RateLimiting
│ │ │ │ ├── QueueProcessingOrder.cs
│ │ │ │ ├── MetadataName.cs
│ │ │ │ └── ReplenishingRateLimiter.cs
│ │ │ └── JsonUtils.cs
│ │ ├── ExportEnvironment
│ │ │ ├── PororocaEnvironmentExporter.cs
│ │ │ └── PostmanEnvironmentExporter.cs
│ │ ├── ExportCollection
│ │ │ └── PororocaCollectionExporter.cs
│ │ ├── RequestRepeater
│ │ │ └── TranslateRepetitionErrors.cs
│ │ └── ImportEnvironment
│ │ │ └── PororocaEnvironmentImporter.cs
│ └── Pororoca.Domain.csproj
├── Pororoca.Infrastructure
│ ├── Pororoca.Infrastructure.csproj
│ └── Features
│ │ └── WebSockets
│ │ └── WebSocketClientSideConnector.cs
├── Pororoca.Domain.OpenAPI
│ └── Pororoca.Domain.OpenAPI.csproj
├── ReactiveUIFody_licence.txt
├── AvaloniaEdit_licence.txt
├── TextMateSharp_licence.md
├── Avalonia_licence.md
├── Dotnet_licence.txt
├── Pororoca.Test
│ └── PororocaTestJsonExtensions.cs
├── Pororoca.Desktop.Localization.SourceGeneration
│ └── Language.cs
└── Oniguruma_licence.txt
├── misc
├── example_screen_en.png
├── example_screen_pt.png
└── licences.txt
├── cleanbuild.ps1
├── .gitattributes
├── rununittests.ps1
└── .vscode
├── tasks.json
└── launch.json
/tests/TestFiles/arq.txt:
--------------------------------------------------------------------------------
1 | oi
--------------------------------------------------------------------------------
/global.json:
--------------------------------------------------------------------------------
1 | {"sdk":{"version":"8.0.415"}}
--------------------------------------------------------------------------------
/tests/Pororoca.Domain.Tests/TestData/testfilecontent1.json:
--------------------------------------------------------------------------------
1 | {"id":1}
--------------------------------------------------------------------------------
/tests/Pororoca.Domain.Tests/TestData/testfilecontent2.json:
--------------------------------------------------------------------------------
1 | {"id":2}
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: alexandrehtrb
2 | open_collective: pororoca
--------------------------------------------------------------------------------
/pororoca.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/pororoca.png
--------------------------------------------------------------------------------
/src/Pororoca.Desktop.Debian/pororoca.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | exec /usr/lib/pororoca/Pororoca "$@"
3 |
--------------------------------------------------------------------------------
/tests/TestFiles/InputData.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "SpecialValue1": "Nissan Skyline"
4 | }
5 | ]
--------------------------------------------------------------------------------
/misc/example_screen_en.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/misc/example_screen_en.png
--------------------------------------------------------------------------------
/misc/example_screen_pt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/misc/example_screen_pt.png
--------------------------------------------------------------------------------
/cleanbuild.ps1:
--------------------------------------------------------------------------------
1 | Get-ChildItem -Include bin,obj,TestResults -Recurse | Remove-Item -Force -Recurse -ErrorAction Ignore
--------------------------------------------------------------------------------
/tests/TestFiles/homem_aranha.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/tests/TestFiles/homem_aranha.jpg
--------------------------------------------------------------------------------
/src/Pororoca.Desktop.MacOSX/pororoca.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/src/Pororoca.Desktop.MacOSX/pororoca.icns
--------------------------------------------------------------------------------
/src/Pororoca.Desktop.MacOSX/icon_1024px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/src/Pororoca.Desktop.MacOSX/icon_1024px.png
--------------------------------------------------------------------------------
/src/Pororoca.Desktop.WindowsInstaller/Common/un.Utils.nsh:
--------------------------------------------------------------------------------
1 | !insertmacro DeleteRetryAbortFunc "un."
2 | !insertmacro CheckSingleInstanceFunc "un."
3 |
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Assets/pororoca_icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/src/Pororoca.Desktop/Assets/pororoca_icon.ico
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Assets/Images/pororoca.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/src/Pororoca.Desktop/Assets/Images/pororoca.png
--------------------------------------------------------------------------------
/tests/Pororoca.Domain.Tests/TestData/pirate.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/tests/Pororoca.Domain.Tests/TestData/pirate.gif
--------------------------------------------------------------------------------
/tests/Pororoca.TestServer/TestFiles/pirate.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/tests/Pororoca.TestServer/TestFiles/pirate.gif
--------------------------------------------------------------------------------
/src/Pororoca.Desktop.Debian/pororoca_icon_16px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/src/Pororoca.Desktop.Debian/pororoca_icon_16px.png
--------------------------------------------------------------------------------
/src/Pororoca.Desktop.Debian/pororoca_icon_32px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/src/Pororoca.Desktop.Debian/pororoca_icon_32px.png
--------------------------------------------------------------------------------
/src/Pororoca.Desktop.Debian/pororoca_icon_48px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/src/Pororoca.Desktop.Debian/pororoca_icon_48px.png
--------------------------------------------------------------------------------
/src/Pororoca.Desktop.Debian/pororoca_icon_64px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/src/Pororoca.Desktop.Debian/pororoca_icon_64px.png
--------------------------------------------------------------------------------
/src/Pororoca.Desktop.Debian/pororoca_icon_1024px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/src/Pororoca.Desktop.Debian/pororoca_icon_1024px.png
--------------------------------------------------------------------------------
/src/Pororoca.Desktop.Debian/pororoca_icon_128px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/src/Pororoca.Desktop.Debian/pororoca_icon_128px.png
--------------------------------------------------------------------------------
/src/Pororoca.Desktop.Debian/pororoca_icon_256px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/src/Pororoca.Desktop.Debian/pororoca_icon_256px.png
--------------------------------------------------------------------------------
/src/Pororoca.Desktop.Debian/pororoca_icon_512px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/src/Pororoca.Desktop.Debian/pororoca_icon_512px.png
--------------------------------------------------------------------------------
/tests/Pororoca.Domain.Tests/TestData/multipartformdata:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/tests/Pororoca.Domain.Tests/TestData/multipartformdata
--------------------------------------------------------------------------------
/tests/TestFiles/ClientCertificates/badssl.com-client.p12:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/tests/TestFiles/ClientCertificates/badssl.com-client.p12
--------------------------------------------------------------------------------
/src/Pororoca.Desktop.WindowsInstaller/Plugins/x86-ansi/UAC.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/src/Pororoca.Desktop.WindowsInstaller/Plugins/x86-ansi/UAC.dll
--------------------------------------------------------------------------------
/src/Pororoca.Desktop.WindowsInstaller/Plugins/x86-unicode/UAC.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/src/Pororoca.Desktop.WindowsInstaller/Plugins/x86-unicode/UAC.dll
--------------------------------------------------------------------------------
/src/Pororoca.Desktop.WindowsInstaller/Plugins/x86-ansi/StdUtils.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/src/Pororoca.Desktop.WindowsInstaller/Plugins/x86-ansi/StdUtils.dll
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Assets/Fonts/Cabin-VariableFont_wdth,wght.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/src/Pororoca.Desktop/Assets/Fonts/Cabin-VariableFont_wdth,wght.ttf
--------------------------------------------------------------------------------
/src/Pororoca.Desktop.WindowsInstaller/Plugins/x86-unicode/StdUtils.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/src/Pororoca.Desktop.WindowsInstaller/Plugins/x86-unicode/StdUtils.dll
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/FodyWeavers.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
--------------------------------------------------------------------------------
/tests/Pororoca.Domain.Tests/TestData/InputData2.json:
--------------------------------------------------------------------------------
1 | [
2 | // comments are allowed
3 | {"Var1":"ABC", "Var2":"123"},
4 | {"Var1":"DEF", "Var2":"456"},
5 | {"Var1":"GHI", "Var2":"789"},
6 | ]
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Assets/Fonts/Cabin-Italic-VariableFont_wdth,wght.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandrehtrb/Pororoca/HEAD/src/Pororoca.Desktop/Assets/Fonts/Cabin-Italic-VariableFont_wdth,wght.ttf
--------------------------------------------------------------------------------
/src/Pororoca.Domain/InternalsExposer.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.CompilerServices;
2 |
3 | [assembly: InternalsVisibleTo("Pororoca.Domain.OpenAPI")]
4 | [assembly: InternalsVisibleTo("Pororoca.Domain.Tests")]
--------------------------------------------------------------------------------
/misc/licences.txt:
--------------------------------------------------------------------------------
1 | Donate with PayPal button: https://www.therearehungrypeople.com/
2 | PIX button: Donate with PayPal button above customized with PIX Logo
3 | PIX logo: https://www.bcb.gov.br/estabilidadefinanceira/pix
4 |
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/UITesting/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | global using AlexandreHtrb.AvaloniaUITest;
2 | global using static AlexandreHtrb.AvaloniaUITest.UITestAssertions;
3 | global using static AlexandreHtrb.AvaloniaUITest.UITestActions;
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/Pororoca/WebSockets/PororocaWebSocketMessageRawContentSyntax.cs:
--------------------------------------------------------------------------------
1 | namespace Pororoca.Domain.Features.Entities.Pororoca.WebSockets;
2 |
3 | public enum PororocaWebSocketMessageRawContentSyntax
4 | {
5 | Json,
6 | Other
7 | }
--------------------------------------------------------------------------------
/tests/Pororoca.Domain.Tests/TestData/EmptyEnvironment.pororoca_environment.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": "Pororoca/Beta",
3 | "id": "eb19683a-3676-4564-9daf-a711661c0862",
4 | "createdAt": "2022-03-03T22:07:56.1967358-03:00",
5 | "name": "Novo ambiente",
6 | "isCurrent": true,
7 | "variables": []
8 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop.Debian/Pororoca.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Name=Pororoca
3 | Comment=HTTP inspection tool
4 | Icon=pororoca
5 | Exec=pororoca
6 | StartupWMClass=pororoca
7 | Terminal=false
8 | Type=Application
9 | Categories=Development
10 | GenericName=Pororoca
11 | Keywords=http; websocket; api
12 |
--------------------------------------------------------------------------------
/tests/Pororoca.TestServer/Configurations/SerilogConfiguration.cs:
--------------------------------------------------------------------------------
1 | namespace Pororoca.TestServer.Configurations;
2 |
3 | public static class SerilogConfiguration
4 | {
5 | public static IServiceCollection AddSerilogLogger(this IServiceCollection services) =>
6 | services.AddSingleton(Serilog.Log.Logger);
7 | }
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/Postman/PostmanRequestBodyFileAttachment.cs:
--------------------------------------------------------------------------------
1 | #nullable disable warnings
2 |
3 | namespace Pororoca.Domain.Features.Entities.Postman;
4 |
5 | internal class PostmanRequestBodyFileAttachment
6 | {
7 | public string? Src { get; set; }
8 | }
9 |
10 | #nullable enable warnings
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Requester/IPororocaHttpClientProvider.cs:
--------------------------------------------------------------------------------
1 | using Pororoca.Domain.Features.Entities.Pororoca;
2 |
3 | namespace Pororoca.Domain.Features.Requester;
4 |
5 | public interface IPororocaHttpClientProvider
6 | {
7 | HttpClient Provide(bool disableSslVerification, PororocaRequestAuth? resolvedAuth);
8 | }
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/Postman/PostmanRequestBodyOptions.cs:
--------------------------------------------------------------------------------
1 | #nullable disable warnings
2 |
3 | namespace Pororoca.Domain.Features.Entities.Postman;
4 |
5 | internal class PostmanRequestBodyOptions
6 | {
7 | public PostmanRequestBodyRawOptions Raw { get; set; }
8 | }
9 |
10 |
11 | #nullable enable warnings
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Common/HttpStatusCodeFormatter.cs:
--------------------------------------------------------------------------------
1 | using System.Net;
2 |
3 | namespace Pororoca.Domain.Features.Common;
4 |
5 | public static class HttpStatusCodeFormatter
6 | {
7 | public static string FormatHttpStatusCodeText(HttpStatusCode statusCode) =>
8 | $"{(int)statusCode} {Enum.GetName(statusCode)}";
9 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Views/WelcomeView.xaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using Avalonia.Markup.Xaml;
3 |
4 | namespace Pororoca.Desktop.Views;
5 |
6 | public sealed class WelcomeView : UserControl
7 | {
8 | public WelcomeView() => InitializeComponent();
9 |
10 | private void InitializeComponent() => AvaloniaXamlLoader.Load(this);
11 | }
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/Postman/PostmanRequestBodyGraphQl.cs:
--------------------------------------------------------------------------------
1 | #nullable disable warnings
2 |
3 | namespace Pororoca.Domain.Features.Entities.Postman;
4 |
5 | internal class PostmanRequestBodyGraphQl
6 | {
7 | public string Query { get; set; }
8 |
9 | public string Variables { get; set; }
10 | }
11 |
12 | #nullable enable warnings
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Views/CollectionView.xaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using Avalonia.Markup.Xaml;
3 |
4 | namespace Pororoca.Desktop.Views;
5 |
6 | public sealed class CollectionView : UserControl
7 | {
8 | public CollectionView() => InitializeComponent();
9 |
10 | private void InitializeComponent() => AvaloniaXamlLoader.Load(this);
11 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Views/EnvironmentView.xaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using Avalonia.Markup.Xaml;
3 |
4 | namespace Pororoca.Desktop.Views;
5 |
6 | public sealed class EnvironmentView : UserControl
7 | {
8 | public EnvironmentView() => InitializeComponent();
9 |
10 | private void InitializeComponent() => AvaloniaXamlLoader.Load(this);
11 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Views/RequestAuthView.xaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using Avalonia.Markup.Xaml;
3 |
4 | namespace Pororoca.Desktop.Views;
5 |
6 | public sealed class RequestAuthView : UserControl
7 | {
8 | public RequestAuthView() => InitializeComponent();
9 |
10 | private void InitializeComponent() => AvaloniaXamlLoader.Load(this);
11 | }
--------------------------------------------------------------------------------
/tests/Pororoca.Domain.Tests/TestData/EmptyCollection.pororoca_collection.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": "Pororoca/Beta",
3 | "id": "ec794541-5c81-49a2-b3d1-113df7432df1",
4 | "name": "Nova coleção",
5 | "createdAt": "2022-03-03T22:04:15.7115044-03:00",
6 | "folders": [],
7 | "requests": [],
8 | "variables": [],
9 | "environments": []
10 | }
--------------------------------------------------------------------------------
/tests/Pororoca.TestServer/Endpoints/WebApplicationExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace Pororoca.TestServer.Endpoints;
2 |
3 | public static class WebApplicationExtensions
4 | {
5 | public static IEndpointConventionBuilder MapConnect(this WebApplication app, string pattern, Delegate reqDelegate) =>
6 | app.MapMethods(pattern, new[] { HttpMethods.Connect }, reqDelegate);
7 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Views/CollectionFolderView.xaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using Avalonia.Markup.Xaml;
3 |
4 | namespace Pororoca.Desktop.Views;
5 |
6 | public sealed class CollectionFolderView : UserControl
7 | {
8 | public CollectionFolderView() => InitializeComponent();
9 |
10 | private void InitializeComponent() => AvaloniaXamlLoader.Load(this);
11 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Views/CollectionsGroupView.xaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using Avalonia.Markup.Xaml;
3 |
4 | namespace Pororoca.Desktop.Views;
5 |
6 | public sealed class CollectionsGroupView : UserControl
7 | {
8 | public CollectionsGroupView() => InitializeComponent();
9 |
10 | private void InitializeComponent() => AvaloniaXamlLoader.Load(this);
11 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Views/ExportCollectionView.xaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using Avalonia.Markup.Xaml;
3 |
4 | namespace Pororoca.Desktop.Views;
5 |
6 | public sealed class ExportCollectionView : UserControl
7 | {
8 | public ExportCollectionView() => InitializeComponent();
9 |
10 | private void InitializeComponent() => AvaloniaXamlLoader.Load(this);
11 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Views/ExportEnvironmentView.xaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using Avalonia.Markup.Xaml;
3 |
4 | namespace Pororoca.Desktop.Views;
5 |
6 | public sealed class ExportEnvironmentView : UserControl
7 | {
8 | public ExportEnvironmentView() => InitializeComponent();
9 |
10 | private void InitializeComponent() => AvaloniaXamlLoader.Load(this);
11 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Views/CollectionVariablesView.xaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using Avalonia.Markup.Xaml;
3 |
4 | namespace Pororoca.Desktop.Views;
5 |
6 | public sealed class CollectionVariablesView : UserControl
7 | {
8 | public CollectionVariablesView() => InitializeComponent();
9 |
10 | private void InitializeComponent() => AvaloniaXamlLoader.Load(this);
11 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Views/CollectionScopedAuthView.xaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using Avalonia.Markup.Xaml;
3 |
4 | namespace Pororoca.Desktop.Views;
5 |
6 | public sealed class CollectionScopedAuthView : UserControl
7 | {
8 | public CollectionScopedAuthView() => InitializeComponent();
9 |
10 | private void InitializeComponent() => AvaloniaXamlLoader.Load(this);
11 | }
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: enhancement
6 | assignees: ''
7 |
8 | ---
9 |
10 | Describe here the feature you want.
11 |
12 | Check the [CONTRIBUTING](https://github.com/alexandrehtrb/Pororoca/blob/develop/CONTRIBUTING.md) file, maybe you can contribute with the code for your idea!
13 |
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Common/FileNameUtils.cs:
--------------------------------------------------------------------------------
1 | namespace Pororoca.Domain.Features.Common;
2 |
3 | internal static class FileNameUtils
4 | {
5 | internal static string? GetFileExtensionWithoutDot(string fileNameOrPath)
6 | {
7 | int lastDotIndex = fileNameOrPath.LastIndexOf('.');
8 | return lastDotIndex != -1 ? fileNameOrPath[(lastDotIndex + 1)..] : null;
9 | }
10 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/UITesting/Robots/BaseRobot.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | namespace Pororoca.Desktop.UITesting.Robots;
3 |
4 | public abstract class BaseRobot
5 | {
6 | public Control RootView { get; }
7 |
8 | protected BaseRobot(Control rootView) => RootView = rootView;
9 |
10 | protected A? GetChildView(string name) where A : Control =>
11 | RootView.FindControl(name);
12 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Views/CollectionScopedRequestHeadersView.xaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using Avalonia.Markup.Xaml;
3 |
4 | namespace Pororoca.Desktop.Views;
5 |
6 | public sealed class CollectionScopedRequestHeadersView : UserControl
7 | {
8 | public CollectionScopedRequestHeadersView() => InitializeComponent();
9 |
10 | private void InitializeComponent() => AvaloniaXamlLoader.Load(this);
11 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/UITesting/Robots/BaseNamedRobot.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using Pororoca.Desktop.Controls;
3 |
4 | namespace Pororoca.Desktop.UITesting.Robots;
5 |
6 | public abstract class BaseNamedRobot : BaseRobot
7 | {
8 | internal EditableTextBlockRobot Name { get; }
9 |
10 | public BaseNamedRobot(Control rootView) : base(rootView) =>
11 | Name = new(GetChildView("etbName")!);
12 | }
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/Pororoca/Http/PororocaHttpRequestBodyGraphQl.cs:
--------------------------------------------------------------------------------
1 | namespace Pororoca.Domain.Features.Entities.Pororoca.Http;
2 |
3 | public sealed record PororocaHttpRequestBodyGraphQl(string? Query, string? Variables)
4 | {
5 | // Parameterless constructor for JSON deserialization
6 | public PororocaHttpRequestBodyGraphQl() : this(null, null) { }
7 |
8 | public PororocaHttpRequestBodyGraphQl Copy() => this with { };
9 | }
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/Postman/PostmanEnvironmentVariable.cs:
--------------------------------------------------------------------------------
1 | #nullable disable warnings
2 |
3 | namespace Pororoca.Domain.Features.Entities.Postman;
4 |
5 | internal class PostmanEnvironmentVariable
6 | {
7 | public string Key { get; set; }
8 |
9 | public string? Value { get; set; }
10 |
11 | public string? Type { get; set; }
12 |
13 | public bool Enabled { get; set; }
14 | }
15 |
16 | #nullable enable warnings
--------------------------------------------------------------------------------
/tests/Pororoca.TestServer/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Serilog": {
3 | "MinimumLevel": {
4 | "Default": "Information",
5 | "Override": {
6 | "Microsoft": "Information",
7 | "System": "Error",
8 | "Microsoft.AspNetCore.Http": "Error",
9 | "Microsoft.AspNetCore.Routing": "Error"
10 | }
11 | },
12 | "Properties": {
13 | "Application": "your-app"
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/UITesting/Robots/CollectionScopedAuthRobot.cs:
--------------------------------------------------------------------------------
1 | using Pororoca.Desktop.Views;
2 |
3 | namespace Pororoca.Desktop.UITesting.Robots;
4 |
5 | public sealed class CollectionScopedAuthRobot : BaseNamedRobot
6 | {
7 | internal RequestAuthRobot Auth { get; }
8 |
9 | public CollectionScopedAuthRobot(CollectionScopedAuthView rootView) : base(rootView) =>
10 | Auth = new(GetChildView("reqAuthView")!);
11 | }
--------------------------------------------------------------------------------
/.github/workflows/pr-to-develop-wfw.yml:
--------------------------------------------------------------------------------
1 | name: PR to develop
2 |
3 | on:
4 | pull_request:
5 | types: [opened, reopened, synchronize]
6 | branches:
7 | - 'develop'
8 | paths:
9 | - '.github/**'
10 | - 'src/**'
11 | - 'tests/**'
12 | - 'LICENCE.md'
13 | - 'Pororoca.sln'
14 |
15 | jobs:
16 | ci:
17 | uses: ./.github/workflows/cicd-wfw.yml
18 | with:
19 | os: ubuntu-latest
20 | runCD: false
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/Pororoca/PororocaRequestAuthWindows.cs:
--------------------------------------------------------------------------------
1 | namespace Pororoca.Domain.Features.Entities.Pororoca;
2 |
3 | public sealed record PororocaRequestAuthWindows(bool UseCurrentUser, string? Login, string? Password, string? Domain)
4 | {
5 | // Parameterless constructor for JSON deserialization
6 | public PororocaRequestAuthWindows() : this(true, null, null, null) { }
7 |
8 | public PororocaRequestAuthWindows Copy() => this with { };
9 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/HotKeys/VariablesClipboardArea.cs:
--------------------------------------------------------------------------------
1 | using Pororoca.Domain.Features.Entities.Pororoca;
2 |
3 | namespace Pororoca.Desktop.HotKeys;
4 |
5 | public sealed class VariablesClipboardArea : SimpleClipboardArea
6 | {
7 | internal static readonly VariablesClipboardArea Instance = new();
8 |
9 | public override List FetchCopies() =>
10 | this.copied.Select(o => o.Copy())
11 | .ToList();
12 | }
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/Postman/PostmanVariable.cs:
--------------------------------------------------------------------------------
1 | #nullable disable warnings
2 |
3 | namespace Pororoca.Domain.Features.Entities.Postman;
4 |
5 | internal class PostmanVariable
6 | {
7 | public string Key { get; set; }
8 |
9 | public string? Value { get; set; }
10 |
11 | public string? Type { get; set; }
12 |
13 | public string? Description { get; set; }
14 |
15 | public bool? Disabled { get; set; }
16 | }
17 |
18 | #nullable enable warnings
--------------------------------------------------------------------------------
/tests/TestFiles/InputData1.json:
--------------------------------------------------------------------------------
1 | [
2 | // comentários são permitidos
3 | {"MyTxt": "ABC", "MyInt": "123"},
4 | {"MyTxt": "DEF", "MyInt": "456"},
5 | {"MyTxt": "GHI", "MyInt": "789"},
6 | {"MyTxt": "JKL", "MyInt": "123"},
7 | {"MyTxt": "MNO", "MyInt": "456"},
8 | {"MyTxt": "PQR", "MyInt": "789"},
9 | {"MyTxt": "STU", "MyInt": "012"},
10 | {"MyTxt": "VWX", "MyInt": "345"},
11 | {"MyTxt": "YZA", "MyInt": "678"},
12 | {"MyTxt": "BCD", "MyInt": "901"},
13 | //{"MyTxt": "ZZZ", "MyInt": "999"},
14 | ]
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Set the default behavior, in case people don't have core.autocrlf set.
2 | * text=auto
3 |
4 | # Explicitly declare text files you want to always be normalized and converted
5 | # to native line endings on checkout.
6 | *.c text
7 | *.h text
8 |
9 | # Declare files that will always have CRLF line endings on checkout.
10 | *.sln text eol=crlf
11 |
12 | # Denote all files that are truly binary and should not be modified.
13 | *.png binary
14 | *.jpg binary
15 | *.p12 binary
16 |
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/Postman/PostmanRequest.cs:
--------------------------------------------------------------------------------
1 | #nullable disable warnings
2 |
3 | namespace Pororoca.Domain.Features.Entities.Postman;
4 |
5 | internal class PostmanRequest
6 | {
7 | public PostmanAuth? Auth { get; set; }
8 |
9 | public string Method { get; set; }
10 |
11 | public PostmanVariable[] Header { get; set; }
12 |
13 | public PostmanRequestBody? Body { get; set; }
14 |
15 | public object? Url { get; set; }
16 | }
17 |
18 | #nullable enable warnings
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/ExportEnvironment/PororocaEnvironmentExporter.cs:
--------------------------------------------------------------------------------
1 | using System.Text.Json;
2 | using Pororoca.Domain.Features.Entities.Pororoca;
3 | using static Pororoca.Domain.Features.Common.JsonConfiguration;
4 |
5 | namespace Pororoca.Domain.Features.ExportEnvironment;
6 |
7 | public static class PororocaEnvironmentExporter
8 | {
9 | public static byte[] ExportAsPororocaEnvironment(PororocaEnvironment env) =>
10 | JsonSerializer.SerializeToUtf8Bytes(env, MainJsonCtx.PororocaEnvironment);
11 | }
--------------------------------------------------------------------------------
/tests/Pororoca.Test.Tests/FactOnlyIfOSSupportsHttp2.cs:
--------------------------------------------------------------------------------
1 | using Xunit;
2 | using static Pororoca.Domain.Features.Common.AvailablePororocaRequestSelectionOptions;
3 |
4 | namespace Pororoca.Test.Tests;
5 |
6 | public sealed class FactOnlyIfOSSupportsHttp2 : FactAttribute
7 | {
8 | public FactOnlyIfOSSupportsHttp2()
9 | {
10 | if (!IsHttpVersionAvailableInOS(2.0m, out _))
11 | {
12 | Skip = ".NET does not support HTTP/2 on this operating system, skipping...";
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/tests/Pororoca.Test.Tests/FactOnlyIfOSSupportsHttp3.cs:
--------------------------------------------------------------------------------
1 | using Xunit;
2 | using static Pororoca.Domain.Features.Common.AvailablePororocaRequestSelectionOptions;
3 |
4 | namespace Pororoca.Test.Tests;
5 |
6 | public sealed class FactOnlyIfOSSupportsHttp3 : FactAttribute
7 | {
8 | public FactOnlyIfOSSupportsHttp3()
9 | {
10 | if (!IsHttpVersionAvailableInOS(3.0m, out _))
11 | {
12 | Skip = ".NET does not support HTTP/3 on this operating system, skipping...";
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/HotKeys/FormDataParamsClipboardArea.cs:
--------------------------------------------------------------------------------
1 | using Pororoca.Domain.Features.Entities.Pororoca.Http;
2 |
3 | namespace Pororoca.Desktop.HotKeys;
4 |
5 | public sealed class FormDataParamsClipboardArea : SimpleClipboardArea
6 | {
7 | internal static readonly FormDataParamsClipboardArea Instance = new();
8 |
9 | public override List FetchCopies() =>
10 | this.copied.Select(o => o.Copy())
11 | .ToList();
12 | }
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/Postman/PostmanRequestBodyRawOptions.cs:
--------------------------------------------------------------------------------
1 | #nullable disable warnings
2 |
3 | using System.Collections.Frozen;
4 |
5 | namespace Pororoca.Domain.Features.Entities.Postman;
6 |
7 | internal class PostmanRequestBodyRawOptions
8 | {
9 | public static readonly FrozenSet PostmanRequestBodyRawLanguages =
10 | new[] { "json", "javascript", "html", "xml", "text" }.ToFrozenSet();
11 |
12 | public string Language { get; set; }
13 | }
14 |
15 |
16 | #nullable enable warnings
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/Pororoca/WebSockets/PororocaWebSocketMessage.cs:
--------------------------------------------------------------------------------
1 | namespace Pororoca.Domain.Features.Entities.Pororoca.WebSockets;
2 |
3 | public enum PororocaWebSocketMessageDirection
4 | {
5 | FromClient,
6 | FromServer
7 | }
8 |
9 | public enum PororocaWebSocketMessageType
10 | {
11 | Binary,
12 | Text,
13 | Close
14 | }
15 |
16 | public abstract record PororocaWebSocketMessage
17 | (
18 | PororocaWebSocketMessageDirection Direction,
19 | PororocaWebSocketMessageType MessageType
20 | );
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/Postman/PostmanCollectionInfo.cs:
--------------------------------------------------------------------------------
1 | #nullable disable warnings
2 |
3 | using System.Text.Json.Serialization;
4 |
5 | namespace Pororoca.Domain.Features.Entities.Postman;
6 |
7 | internal class PostmanCollectionInfo
8 | {
9 | [JsonPropertyName("_postman_id")]
10 | public Guid Id { get; set; }
11 |
12 | public string Name { get; set; }
13 |
14 | public string? Description { get; set; }
15 |
16 | public string Schema { get; set; }
17 | }
18 |
19 |
20 | #nullable enable warnings
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/HotKeys/HttpResponseCapturesClipboardArea.cs:
--------------------------------------------------------------------------------
1 | using Pororoca.Domain.Features.Entities.Pororoca.Http;
2 |
3 | namespace Pororoca.Desktop.HotKeys;
4 |
5 | public sealed class HttpResponseCapturesClipboardArea : SimpleClipboardArea
6 | {
7 | internal static readonly HttpResponseCapturesClipboardArea Instance = new();
8 |
9 | public override List FetchCopies() =>
10 | this.copied.Select(o => o.Copy())
11 | .ToList();
12 | }
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/Postman/PostmanRequestUrl.cs:
--------------------------------------------------------------------------------
1 | #nullable disable warnings
2 |
3 | namespace Pororoca.Domain.Features.Entities.Postman;
4 |
5 | internal class PostmanRequestUrl
6 | {
7 | public string Raw { get; set; }
8 |
9 | public string? Protocol { get; set; }
10 |
11 | public string[] Host { get; set; }
12 |
13 | public string[]? Path { get; set; }
14 |
15 | public string? Port { get; set; }
16 |
17 | public PostmanVariable[]? Query { get; set; }
18 | }
19 |
20 |
21 | #nullable enable warnings
--------------------------------------------------------------------------------
/tests/Pororoca.Domain.Tests/TestData/TestEnvironment.postman_environment.json:
--------------------------------------------------------------------------------
1 | {
2 | "id": "8b34e2c4-3384-4ebd-996e-24c0e63ee256",
3 | "name": "TestEnvironment",
4 | "values": [
5 | {
6 | "key": "Key1",
7 | "value": "Value1",
8 | "enabled": true
9 | },
10 | {
11 | "key": "Key2",
12 | "value": "Value2",
13 | "type": "secret",
14 | "enabled": false
15 | }
16 | ],
17 | "_postman_variable_scope": "environment",
18 | "_postman_exported_at": "2021-04-01T00:57:06.703Z",
19 | "_postman_exported_using": "Postman/8.0.10"
20 | }
--------------------------------------------------------------------------------
/tests/Pororoca.TestServer/TestFiles/ascii.txt:
--------------------------------------------------------------------------------
1 | <>================================<>
2 | ||\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/||
3 | ||<> <> <> <> <> <> <> <> <> <> <>||
4 | ||/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\||
5 | ||================================||
6 | ||<> <> <> <> <> <> <> <> <> <> <>||
7 | ||================================||
8 | ||/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\||
9 | ||<> <> <> <> <> <> <> <> <> <> <>||
10 | ||\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/||
11 | <>================================<>
12 |
13 | Simple
14 | Cross-Stitch Pattern
15 | gfj/98
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Common/HttpVersionFormatter.cs:
--------------------------------------------------------------------------------
1 | using System.Globalization;
2 |
3 | namespace Pororoca.Domain.Features.Common;
4 |
5 | public static class HttpVersionFormatter
6 | {
7 | public static string FormatHttpVersion(decimal version) =>
8 | version switch
9 | {
10 | 1.0m => "HTTP/1.0",
11 | 1.1m => "HTTP/1.1",
12 | 2.0m => "HTTP/2",
13 | 3.0m => "HTTP/3",
14 | _ => string.Format(CultureInfo.InvariantCulture, "HTTP/{0:0.0}", version)
15 | };
16 | }
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/Pororoca/PororocaKeyValueParam.cs:
--------------------------------------------------------------------------------
1 | namespace Pororoca.Domain.Features.Entities.Pororoca;
2 |
3 | public sealed record PororocaKeyValueParam(bool Enabled, string Key, string? Value)
4 | {
5 | // Parameterless constructor for JSON deserialization
6 | public PororocaKeyValueParam() : this(true, string.Empty, string.Empty) { }
7 |
8 | public PororocaKeyValueParam Copy() => this with { };
9 |
10 | #if DEBUG
11 | public override string ToString() => $"{(Enabled ? "✔️" : "⛔")} {Key}: \"{Value}\"";
12 | #endif
13 | }
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/Postman/PostmanCollectionItem.cs:
--------------------------------------------------------------------------------
1 | #nullable disable warnings
2 |
3 | using System.Text.Json.Serialization;
4 |
5 | namespace Pororoca.Domain.Features.Entities.Postman;
6 |
7 | internal class PostmanCollectionItem
8 | {
9 | public string Name { get; set; }
10 |
11 | [JsonPropertyName("item")]
12 | public PostmanCollectionItem[]? Items { get; set; }
13 |
14 | public PostmanRequest? Request { get; set; }
15 |
16 | public object[] Response { get; set; }
17 | }
18 |
19 |
20 | #nullable enable warnings
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/GitHub/GitHubGetReleaseResponse.cs:
--------------------------------------------------------------------------------
1 | using System.Text.Json.Serialization;
2 |
3 | namespace Pororoca.Domain.Features.Entities.GitHub;
4 |
5 | public sealed class GitHubGetReleaseResponse
6 | {
7 | #nullable disable warnings
8 |
9 | [JsonPropertyName("html_url")]
10 | public string HtmlUrl { get; set; }
11 |
12 | [JsonPropertyName("name")]
13 | public string VersionName { get; set; }
14 |
15 | [JsonPropertyName("body")]
16 | public string Description { get; set; }
17 |
18 | #nullable restore warnings
19 | }
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Pororoca.Domain.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Pororoca.Domain
5 | net8.0
6 | enable
7 | enable
8 | embedded
9 | True
10 | True
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Controls/VariablesTableView.xaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using Avalonia.Markup.Xaml;
3 | using Pororoca.Desktop.ViewModels.DataGrids;
4 |
5 | namespace Pororoca.Desktop.Controls;
6 |
7 | public sealed class VariablesTableView : UserControl
8 | {
9 | public VariablesTableView() => InitializeComponent();
10 |
11 | private void InitializeComponent() => AvaloniaXamlLoader.Load(this);
12 |
13 | public void OnSelectedVariablesChanged(object sender, SelectionChangedEventArgs e) =>
14 | ((VariablesDataGridViewModel)DataContext!).UpdateSelectedItems(e);
15 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Styles/Themes.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Controls/RequestHeadersTableView.xaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using Avalonia.Markup.Xaml;
3 | using Pororoca.Desktop.ViewModels.DataGrids;
4 |
5 | namespace Pororoca.Desktop.Controls;
6 |
7 | public sealed class RequestHeadersTableView : UserControl
8 | {
9 | public RequestHeadersTableView() => InitializeComponent();
10 |
11 | private void InitializeComponent() => AvaloniaXamlLoader.Load(this);
12 |
13 | public void OnSelectedRequestHeadersChanged(object sender, SelectionChangedEventArgs e) =>
14 | ((RequestHeadersDataGridViewModel)DataContext!).UpdateSelectedItems(e);
15 | }
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/Pororoca/PororocaRequest.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.Text.Json.Serialization;
3 |
4 | namespace Pororoca.Domain.Features.Entities.Pororoca;
5 |
6 | public enum PororocaRequestType
7 | {
8 | Http,
9 | Websocket,
10 | HttpRepetition
11 | }
12 |
13 | #if DEBUG
14 | [DebuggerDisplay("{Name,nq}")]
15 | #endif
16 | public abstract record PororocaRequest
17 | (
18 | [property: JsonPropertyOrder(-3)] PororocaRequestType RequestType,
19 | [property: JsonPropertyOrder(-2)] string Name
20 | )
21 | {
22 | public abstract PororocaRequest CopyAbstract();
23 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Styles/Fonts.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 | avares://Pororoca.Desktop/Assets/Fonts#Cabin
8 | Cascadia Mono,Consolas,Comic Mono,Monaco,Noto Sans Mono,Liberation Mono,Courier New,DejaVu Sans Mono,Menlo,monospace
9 |
10 |
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Controls/ResponseHeadersTableView.xaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using Avalonia.Markup.Xaml;
3 | using Pororoca.Desktop.ViewModels.DataGrids;
4 |
5 | namespace Pororoca.Desktop.Controls;
6 |
7 | public sealed class ResponseHeadersTableView : UserControl
8 | {
9 | public ResponseHeadersTableView() => InitializeComponent();
10 |
11 | private void InitializeComponent() => AvaloniaXamlLoader.Load(this);
12 |
13 | public void OnSelectedResponseHeadersAndTrailersChanged(object sender, SelectionChangedEventArgs e) =>
14 | ((KeyValueParamsDataGridViewModel)DataContext!).UpdateSelectedItems(e);
15 | }
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/Pororoca/WebSockets/WebSocketMessageTypeExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Net.WebSockets;
2 |
3 | namespace Pororoca.Domain.Features.Entities.Pororoca.WebSockets;
4 |
5 | public static class WebSocketMessageTypeExtensions
6 | {
7 | public static WebSocketMessageType ToWebSocketMessageType(this PororocaWebSocketMessageType msgType) =>
8 | msgType switch
9 | {
10 | PororocaWebSocketMessageType.Text => WebSocketMessageType.Text,
11 | PororocaWebSocketMessageType.Close => WebSocketMessageType.Close,
12 | _ => WebSocketMessageType.Binary
13 | };
14 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/ViewModels/ViewModelBase.cs:
--------------------------------------------------------------------------------
1 | using Pororoca.Desktop.HotKeys;
2 | using Pororoca.Desktop.Localization;
3 | using Pororoca.Desktop.Views;
4 | using ReactiveUI;
5 |
6 | namespace Pororoca.Desktop.ViewModels;
7 |
8 | public abstract class ViewModelBase : ReactiveObject
9 | {
10 | public Localizer i18n { get; } = Localizer.Instance;
11 |
12 | public KeyboardShortcuts HotKeys { get; } = KeyboardShortcuts.Instance;
13 |
14 | public ClipboardArea ClipboardArea { get; } = ClipboardArea.Instance;
15 |
16 | protected static MainWindowViewModel MainWindowVm =>
17 | (MainWindowViewModel)MainWindow.Instance!.DataContext!;
18 | }
--------------------------------------------------------------------------------
/tests/Pororoca.Domain.Tests/Features/Common/HttpVersionFormatterTests.cs:
--------------------------------------------------------------------------------
1 | using Xunit;
2 | using static Pororoca.Domain.Features.Common.HttpVersionFormatter;
3 |
4 | namespace Pororoca.Domain.Tests.Features.Common;
5 |
6 | public static class HttpVersionFormatterTests
7 | {
8 | [Theory]
9 | [InlineData("HTTP/1.0", 1.0)]
10 | [InlineData("HTTP/1.1", 1.1)]
11 | [InlineData("HTTP/2", 2.0)]
12 | [InlineData("HTTP/3", 3.0)]
13 | [InlineData("HTTP/4.0", 4.0)]
14 | public static void Should_properly_format_HTTP_version_as_string(string expectedStr, float httpVersion) =>
15 | Assert.Equal(expectedStr, FormatHttpVersion((decimal)httpVersion));
16 | }
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/Postman/PostmanCollectionV21.cs:
--------------------------------------------------------------------------------
1 | #nullable disable warnings
2 |
3 | using System.Text.Json.Serialization;
4 |
5 | namespace Pororoca.Domain.Features.Entities.Postman;
6 |
7 | internal class PostmanCollectionV21
8 | {
9 | public const string SchemaUrl = "https://schema.getpostman.com/json/collection/v2.1.0/collection.json";
10 |
11 | public PostmanCollectionInfo Info { get; set; }
12 |
13 | [JsonPropertyName("item")]
14 | public PostmanCollectionItem[] Items { get; set; }
15 |
16 | public PostmanVariable[]? Variable { get; set; }
17 |
18 | public PostmanAuth? Auth { get; set; }
19 | }
20 |
21 | #nullable enable warnings
--------------------------------------------------------------------------------
/tests/Pororoca.TestServer/Endpoints/WebSocketServerSideConnector.cs:
--------------------------------------------------------------------------------
1 | using System.Net.WebSockets;
2 | using Pororoca.Infrastructure.Features.WebSockets;
3 |
4 | namespace Pororoca.TestServer.Endpoints;
5 |
6 | public sealed class WebSocketServerSideConnector : WebSocketConnector
7 | {
8 | protected override WebSocketMessageDirection DirectionFromThis =>
9 | WebSocketMessageDirection.FromServer;
10 |
11 | public WebSocketServerSideConnector(WebSocket ws)
12 | {
13 | // when this connector gets created, the connection is already established
14 | this.ws = ws;
15 | SetIsConnected();
16 | base.SetupAfterConnected();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/UITesting/Robots/CollectionFolderRobot.cs:
--------------------------------------------------------------------------------
1 | using Pororoca.Desktop.Controls;
2 | using Pororoca.Desktop.Views;
3 |
4 | namespace Pororoca.Desktop.UITesting.Robots;
5 |
6 | public sealed class CollectionFolderRobot : BaseNamedRobot
7 | {
8 | public CollectionFolderRobot(CollectionFolderView rootView) : base(rootView) { }
9 |
10 | internal IconButton AddFolder => GetChildView("btAddFolder")!;
11 | internal IconButton AddHttpReq => GetChildView("btAddHttpReq")!;
12 | internal IconButton AddWebSocket => GetChildView("btAddWebSocket")!;
13 | internal IconButton AddRepeater => GetChildView("btAddHttpRep")!;
14 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/ViewModels/CollectionVariablesViewModel.cs:
--------------------------------------------------------------------------------
1 | using Pororoca.Desktop.ViewModels.DataGrids;
2 | using Pororoca.Domain.Features.Entities.Pororoca;
3 | using ReactiveUI.Fody.Helpers;
4 |
5 | namespace Pororoca.Desktop.ViewModels;
6 |
7 | public sealed class CollectionVariablesViewModel : CollectionOrganizationItemViewModel
8 | {
9 | [Reactive]
10 | public VariablesDataGridViewModel VariablesTableVm { get; set; }
11 |
12 | public CollectionVariablesViewModel(ICollectionOrganizationItemParentViewModel parentVm,
13 | PororocaCollection col) : base(parentVm, col.Name) =>
14 | VariablesTableVm = new(col.Variables);
15 | }
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/Pororoca/PororocaVariable.cs:
--------------------------------------------------------------------------------
1 | namespace Pororoca.Domain.Features.Entities.Pororoca;
2 |
3 | public sealed record PororocaVariable(bool Enabled, string Key, string? Value, bool IsSecret)
4 | {
5 | // Parameterless constructor for JSON deserialization
6 | public PororocaVariable() : this(true, string.Empty, null, false) { }
7 |
8 | public PororocaVariable Copy() => this with { };
9 |
10 | public PororocaVariable Censor() => this with { Value = IsSecret ? string.Empty : Value };
11 |
12 | #if DEBUG
13 | public override string ToString() => $"{(Enabled ? "✔️" : "⛔")}{(IsSecret ? "🔒" : string.Empty)} {Key}: \"{Value}\"";
14 | #endif
15 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/ViewModels/CollectionScopedAuthViewModel.cs:
--------------------------------------------------------------------------------
1 | using Pororoca.Domain.Features.Entities.Pororoca;
2 | using ReactiveUI.Fody.Helpers;
3 |
4 | namespace Pororoca.Desktop.ViewModels;
5 |
6 | public sealed class CollectionScopedAuthViewModel : CollectionOrganizationItemViewModel
7 | {
8 | [Reactive]
9 | public RequestAuthViewModel AuthVm { get; set; } // TODO: Remove InheritedFromCollection option
10 |
11 | public CollectionScopedAuthViewModel(ICollectionOrganizationItemParentViewModel parentVm,
12 | PororocaCollection col) : base(parentVm, string.Empty) =>
13 | AuthVm = new(col.CollectionScopedAuth, false, () => { });
14 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Views/ImportExportCurlWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using Avalonia.Interactivity;
3 | using Avalonia.Markup.Xaml;
4 | using Pororoca.Desktop.ViewModels;
5 |
6 | namespace Pororoca.Desktop.Views;
7 |
8 | public partial class ImportExportCurlWindow : Window
9 | {
10 | public ImportExportCurlWindow() => AvaloniaXamlLoader.Load(this);
11 |
12 | public void RunOkClicked(object sender, RoutedEventArgs args)
13 | {
14 | if (DataContext is ImportExportCurlWindowViewModel vm && vm.RunOkClicked())
15 | {
16 | Close();
17 | }
18 | }
19 |
20 | public void Cancel(object sender, RoutedEventArgs args) => Close();
21 | }
--------------------------------------------------------------------------------
/tests/Pororoca.Domain.Tests/Features/Common/HttpStatusCodeFormatterTests.cs:
--------------------------------------------------------------------------------
1 | using System.Net;
2 | using Xunit;
3 | using static Pororoca.Domain.Features.Common.HttpStatusCodeFormatter;
4 |
5 | namespace Pororoca.Domain.Tests.Features.Common;
6 |
7 | public static class HttpStatusCodeFormatterTests
8 | {
9 | [Theory]
10 | [InlineData("200 OK", HttpStatusCode.OK)]
11 | [InlineData("404 NotFound", HttpStatusCode.NotFound)]
12 | [InlineData("500 InternalServerError", HttpStatusCode.InternalServerError)]
13 | public static void Should_properly_format_HTTP_status_code_as_text(string expected, HttpStatusCode statusCode) =>
14 | Assert.Equal(expected, FormatHttpStatusCodeText(statusCode));
15 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Views/UITestsRunnerWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using Avalonia.Interactivity;
3 | using Avalonia.Markup.Xaml;
4 | using Pororoca.Desktop.ViewModels;
5 |
6 | namespace Pororoca.Desktop.Views;
7 |
8 | public partial class UITestsRunnerWindow : Window
9 | {
10 | public UITestsRunnerWindow()
11 | {
12 | AvaloniaXamlLoader.Load(this);
13 | DataContext = UITestsRunnerWindowViewModel.Instance;
14 | UITestsRunnerWindowViewModel.Instance.CheckIfTestFilesFolderExist();
15 | }
16 |
17 | public void RunTests(object sender, RoutedEventArgs args)
18 | {
19 | Close();
20 | UITestsRunnerWindowViewModel.Instance.RunTests();
21 | }
22 | }
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/Pororoca/Http/PororocaHttpResponseValueCapture.cs:
--------------------------------------------------------------------------------
1 | namespace Pororoca.Domain.Features.Entities.Pororoca.Http;
2 |
3 | public enum PororocaHttpResponseValueCaptureType
4 | {
5 | Header = 1,
6 | Body = 2
7 | }
8 |
9 | public sealed record PororocaHttpResponseValueCapture(
10 | PororocaHttpResponseValueCaptureType Type,
11 | string TargetVariable,
12 | string? HeaderName,
13 | string? Path)
14 | {
15 | // Parameterless constructor for JSON deserialization
16 | public PororocaHttpResponseValueCapture() : this(PororocaHttpResponseValueCaptureType.Body, string.Empty, null, null) { }
17 |
18 | public PororocaHttpResponseValueCapture Copy() => this with { };
19 | }
--------------------------------------------------------------------------------
/src/Pororoca.Infrastructure/Pororoca.Infrastructure.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Pororoca.Infrastructure
5 | net8.0
6 | enable
7 | enable
8 | embedded
9 | True
10 | True
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/HotKeys/SimpleClipboardArea.cs:
--------------------------------------------------------------------------------
1 | using Pororoca.Desktop.ViewModels;
2 | using ReactiveUI.Fody.Helpers;
3 |
4 | namespace Pororoca.Desktop.HotKeys;
5 |
6 | public abstract class SimpleClipboardArea : ViewModelBase
7 | {
8 | protected readonly List copied = new();
9 |
10 | [Reactive]
11 | public virtual bool CanPaste { get; private set; }
12 |
13 | public void Clear()
14 | {
15 | this.copied.Clear();
16 | CanPaste = false;
17 | }
18 |
19 | public void PushToArea(params T[] itemsToCopy)
20 | {
21 | this.copied.Clear();
22 | this.copied.AddRange(itemsToCopy);
23 | CanPaste = this.copied.Count > 0;
24 | }
25 |
26 | public abstract List FetchCopies();
27 | }
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/Postman/PostmanEnvironment.cs:
--------------------------------------------------------------------------------
1 | #nullable disable warnings
2 |
3 | using System.Text.Json.Serialization;
4 |
5 | namespace Pororoca.Domain.Features.Entities.Postman;
6 |
7 | internal class PostmanEnvironment
8 | {
9 | public Guid Id { get; set; }
10 |
11 | public string Name { get; set; }
12 |
13 | public PostmanEnvironmentVariable[] Values { get; set; }
14 |
15 | [JsonPropertyName("_postman_variable_scope")]
16 | public string Scope { get; set; }
17 |
18 | [JsonPropertyName("_postman_exported_at")]
19 | public string ExportedAt { get; set; }
20 |
21 | [JsonPropertyName("_postman_exported_using")]
22 | public string ExportedUsing { get; set; }
23 | }
24 |
25 | #nullable enable warnings
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/ExportCollection/PororocaCollectionExporter.cs:
--------------------------------------------------------------------------------
1 | using System.Text.Json;
2 | using Pororoca.Domain.Features.Entities.Pororoca;
3 | using static Pororoca.Domain.Features.Common.JsonConfiguration;
4 |
5 | namespace Pororoca.Domain.Features.ExportCollection;
6 |
7 | public static class PororocaCollectionExporter
8 | {
9 | public static void ExportAsPororocaCollection(Stream streamToWrite, PororocaCollection col) =>
10 | JsonSerializer.Serialize(streamToWrite, col, MainJsonCtxWithConverters.PororocaCollection);
11 |
12 | public static Task ExportAsPororocaCollectionAsync(Stream streamToWrite, PororocaCollection col) =>
13 | JsonSerializer.SerializeAsync(streamToWrite, col, MainJsonCtxWithConverters.PororocaCollection);
14 | }
--------------------------------------------------------------------------------
/tests/Pororoca.TestServer/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Serilog": {
3 | "MinimumLevel": {
4 | "Default": "Information",
5 | "Override": {
6 | "Microsoft": "Information",
7 | "System": "Error",
8 | "Microsoft.AspNetCore.Http": "Error",
9 | "Microsoft.AspNetCore.Routing": "Error"
10 | }
11 | },
12 | "Properties": {
13 | "Application": "your-app"
14 | }
15 | },
16 | "Kestrel": {
17 | "Endpoints": {
18 | "Http": {
19 | "Url": "http://localhost:5000",
20 | "Protocols": "Http1AndHttp2"
21 | },
22 | "Https": {
23 | "Url": "https://localhost:5001",
24 | "Protocols": "Http1AndHttp2AndHttp3"
25 | }
26 | }
27 | },
28 | "AllowedHosts": "*"
29 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop.Debian/control:
--------------------------------------------------------------------------------
1 | Package: pororoca
2 | Version: 3.9.0
3 | Section: devel
4 | Priority: optional
5 | Architecture: amd64
6 | Installed-Size: 68279
7 | Depends: libx11-6, libice6, libsm6, libfontconfig1, ca-certificates, tzdata, libc6, libgcc1 | libgcc-s1, libgssapi-krb5-2, libstdc++6, zlib1g, libssl1.0.0 | libssl1.0.2 | libssl1.1 | libssl3, libicu | libicu74 | libicu72 | libicu71 | libicu70 | libicu69 | libicu68 | libicu67 | libicu66 | libicu65 | libicu63 | libicu60 | libicu57 | libicu55 | libicu52
8 | Maintainer: Alexandre H. T. R. Bonfitto
9 | Homepage: https://pororoca.io
10 | Description: This is Pororoca, a HTTP inspection tool, for Debian-related distros.
11 | Copyright: 2022-2025 Alexandre H. T. R. Bonfitto
12 |
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/Postman/PostmanRequestBodyFormDataParam.cs:
--------------------------------------------------------------------------------
1 | #nullable disable warnings
2 |
3 | namespace Pororoca.Domain.Features.Entities.Postman;
4 |
5 | internal enum PostmanRequestBodyFormDataParamType
6 | {
7 | Text,
8 | File,
9 | Default
10 | }
11 |
12 | internal class PostmanRequestBodyFormDataParam
13 | {
14 | public string Key { get; set; }
15 |
16 | public string? Value { get; set; }
17 |
18 | public string? ContentType { get; set; }
19 |
20 | public PostmanRequestBodyFormDataParamType Type { get; set; }
21 |
22 | ///
23 | /// string list of file paths.
24 | ///
25 | public object? Src { get; set; }
26 |
27 | public bool? Disabled { get; set; }
28 |
29 | }
30 |
31 | #nullable enable warnings
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Styles/SideBar.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
10 |
15 |
20 |
--------------------------------------------------------------------------------
/src/Pororoca.Domain.OpenAPI/Pororoca.Domain.OpenAPI.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Pororoca.Domain
5 | net8.0
6 | enable
7 | enable
8 | embedded
9 | True
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Common/System.Threading.RateLimiting/QueueProcessingOrder.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | namespace System.Threading.RateLimiting
5 | {
6 | ///
7 | /// Controls the behavior of when not enough resources can be leased.
8 | ///
9 | public enum QueueProcessingOrder
10 | {
11 | ///
12 | /// Lease the oldest queued call.
13 | ///
14 | OldestFirst,
15 | ///
16 | /// Lease the newest queued call.
17 | ///
18 | NewestFirst
19 | }
20 | }
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/Postman/PostmanRequestBody.cs:
--------------------------------------------------------------------------------
1 | #nullable disable warnings
2 |
3 | namespace Pororoca.Domain.Features.Entities.Postman;
4 |
5 | internal enum PostmanRequestBodyMode
6 | {
7 | Raw,
8 | Urlencoded,
9 | Formdata,
10 | File,
11 | Graphql
12 | }
13 |
14 | internal class PostmanRequestBody
15 | {
16 | public PostmanRequestBodyMode Mode { get; set; }
17 |
18 | public string? Raw { get; set; }
19 |
20 | public PostmanRequestBodyOptions? Options { get; set; }
21 |
22 | public PostmanRequestBodyFormDataParam[]? Formdata { get; set; }
23 |
24 | public PostmanVariable[]? Urlencoded { get; set; }
25 |
26 | public PostmanRequestBodyFileAttachment? File { get; set; }
27 |
28 | public PostmanRequestBodyGraphQl? Graphql { get; set; }
29 | }
30 |
31 |
32 | #nullable enable warnings
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/ViewLocator.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using Avalonia.Controls.Templates;
3 | using Pororoca.Desktop.ViewModels;
4 |
5 | namespace Pororoca.Desktop;
6 |
7 | public sealed class ViewLocator : IDataTemplate
8 | {
9 | public Control? Build(object? data)
10 | {
11 | string? name = data?.GetType()?.FullName?.Replace("ViewModel", "View");
12 | #pragma warning disable IL2057
13 | var type = name != null ? Type.GetType(name) : null;
14 | #pragma warning restore IL2057
15 |
16 | if (type != null)
17 | {
18 | return (Control)Activator.CreateInstance(type)!;
19 | }
20 | else
21 | {
22 | return new TextBlock { Text = "Not Found: " + name };
23 | }
24 | }
25 |
26 | public bool Match(object? data) =>
27 | data is ViewModelBase;
28 | }
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Requester/IPororocaRequester.cs:
--------------------------------------------------------------------------------
1 | using Pororoca.Domain.Features.Entities.Pororoca;
2 | using Pororoca.Domain.Features.Entities.Pororoca.Http;
3 |
4 | namespace Pororoca.Domain.Features.Requester;
5 |
6 | public interface IPororocaRequester
7 | {
8 | bool DisableSslVerification { get; set; }
9 |
10 | bool IsValidRequest(IEnumerable effectiveVars, PororocaRequestAuth? collectionScopedAuth, PororocaHttpRequest req, out string? errorCode);
11 |
12 | // TODO: Customizable timeout period
13 | // TODO: Optional compressed request or response
14 | Task RequestAsync(IEnumerable effectiveVars, PororocaRequestAuth? collectionScopedAuth, List? collectionScopedReqHeaders, PororocaHttpRequest req, CancellationToken cancellationToken = default);
15 | }
--------------------------------------------------------------------------------
/tests/Pororoca.TestServer/Pororoca.TestServer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | PororocaTestServer
5 | Pororoca.TestServer
6 | net8.0
7 | enable
8 | enable
9 | True
10 | true
11 | AD0001
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | # Lines starting with '#' are comments.
2 | # Each line is a file pattern followed by one or more owners.
3 |
4 | # More details are here: https://help.github.com/articles/about-codeowners/
5 |
6 | # The '*' pattern is global owners.
7 |
8 | # Order is important. The last matching pattern has the most precedence.
9 | # The folders are ordered as follows:
10 |
11 | # In each subsection folders are ordered first by depth, then alphabetically.
12 | # This should make it easy to add new rules without breaking existing ones.
13 |
14 | * @alexandrehtrb
15 |
16 | # Global rule:
17 | # * @dotnet/docs
18 |
19 | # C# samples:
20 | # /csharp/** @BillWagner
21 |
22 | # ML.NET samples:
23 | # /machine-learning/** @luisquintanilla
24 |
25 | # WPF folders:
26 | # /wpf/** @adegeo
27 |
28 | # Windows forms areas:
29 | # /windowsforms/** @adegeo @dotnet/dotnet-winforms
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: bug
6 | assignees: ''
7 |
8 | ---
9 |
10 | A clear and concise description of what the bug is.
11 |
12 | ### Crash reports
13 |
14 | Include crash reports, if any. They are located at:
15 |
16 | | Operating system | Packaging | `PororocaUserData` folder location |
17 | |------------------|-----------|-----------------------------|
18 | | Linux, Windows | portable | alongside the executable |
19 | | Debian | deb | `/home/you/.config/Pororoca/` |
20 | | Windows | installer | `C:\Users\you\AppData\Roaming\Pororoca\` |
21 | | Mac OSX | application | `/Users/you/Library/Application Support/Pororoca/` |
22 |
23 | ### Environment
24 |
25 | - **OS**: Windows, Linux, Mac OSX
26 | - **Packaging** : installer, portable, debian
27 | - **Pororoca version**: x.y.z
28 |
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/ViewModels/PageHolder.cs:
--------------------------------------------------------------------------------
1 | using ReactiveUI;
2 |
3 | namespace Pororoca.Desktop.ViewModels;
4 |
5 | public abstract class PageHolder : ReactiveObject
6 | {
7 | public abstract Type PageType { get; }
8 |
9 | private bool visibleField;
10 | public bool Visible
11 | {
12 | get => this.visibleField;
13 | set => this.RaiseAndSetIfChanged(ref this.visibleField, value);
14 | }
15 |
16 | public abstract void SetVM(ViewModelBase? vm);
17 | }
18 |
19 | public sealed class PageHolder : PageHolder where X : ViewModelBase
20 | {
21 | public override Type PageType => typeof(X);
22 |
23 | private X? vmField;
24 | public X? VM
25 | {
26 | get => this.vmField;
27 | private set => this.RaiseAndSetIfChanged(ref this.vmField, value);
28 | }
29 |
30 | public override void SetVM(ViewModelBase? vm) =>
31 | VM = (X?)vm;
32 | }
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/Pororoca/PororocaRequestAuthClientCertificate.cs:
--------------------------------------------------------------------------------
1 | using System.Text.Json.Serialization;
2 |
3 | namespace Pororoca.Domain.Features.Entities.Pororoca;
4 |
5 | public enum PororocaRequestAuthClientCertificateType
6 | {
7 | Pkcs12,
8 | Pem
9 | }
10 |
11 | public sealed record PororocaRequestAuthClientCertificate
12 | (
13 | [property: JsonInclude] PororocaRequestAuthClientCertificateType Type,
14 | [property: JsonInclude] string CertificateFilePath,
15 | [property: JsonInclude] string? PrivateKeyFilePath,
16 | [property: JsonInclude] string? FilePassword
17 | )
18 | {
19 | // Parameterless constructor for JSON deserialization
20 | public PororocaRequestAuthClientCertificate() : this(PororocaRequestAuthClientCertificateType.Pem, string.Empty, string.Empty, null) { }
21 |
22 | public PororocaRequestAuthClientCertificate Copy() => this with { };
23 | }
--------------------------------------------------------------------------------
/rununittests.ps1:
--------------------------------------------------------------------------------
1 | # Para instalar o Report Generator:
2 | # To install the Report Generator:
3 | # dotnet tool install -g dotnet-reportgenerator-globaltool
4 |
5 | Remove-Item "./TestResults/" -Recurse -ErrorAction Ignore
6 | dotnet test --collect:"XPlat Code Coverage" --results-directory "./TestResults/" --filter FullyQualifiedName!~Pororoca.Test.Tests
7 | reportgenerator "-reports:./TestResults/**/coverage.cobertura.xml" `
8 | "-targetdir:./TestResults/" `
9 | "-assemblyfilters:+Pororoca.Domain;+Pororoca.Domain.OpenAPI" `
10 | "-classfilters:-System.Threading.RateLimiting.*;-System.Collections.Generic.*;-Pororoca.Domain.Features.Common.PororocaLogger" `
11 | "-riskhotspotclassfilters:-System.Threading.RateLimiting.*;-System.Collections.Generic.*;-Pororoca.Domain.Features.Common.PororocaLogger" `
12 | "-filefilters:-*.g.cs" `
13 | "-reporttypes:Html"
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/UITesting/Tests/HttpRequests/PostEmpty.cs:
--------------------------------------------------------------------------------
1 | namespace Pororoca.Desktop.UITesting.Tests;
2 |
3 | public sealed partial class HttpRequestsUITest : PororocaUITest
4 | {
5 | private async Task TestPostEmptyBody()
6 | {
7 | await HttpRobot.HttpMethod.Select("POST");
8 | await HttpRobot.Url.ClearAndTypeText("{{BaseUrl}}/test/post/none");
9 | await HttpRobot.SetEmptyBody();
10 | await HttpRobot.ClickOnSendAndWaitForResponse();
11 |
12 | HttpRobot.ResTitle.AssertContainsText("Response: 204 NoContent");
13 | await HttpRobot.TabControlRes.Select(HttpRobot.TabResHeaders);
14 | AssertContainsResponseHeader("Date");
15 | AssertContainsResponseHeader("Server", "Kestrel");
16 | await HttpRobot.TabControlRes.Select(HttpRobot.TabResBody);
17 | HttpRobot.ResBodyRawContent.AssertHasText(string.Empty);
18 | HttpRobot.ResBodySaveToFile.AssertIsHidden();
19 | }
20 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Views/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Controls;
3 | using Avalonia.Interactivity;
4 | using Avalonia.Markup.Xaml;
5 | using Pororoca.Desktop.TextEditorConfig;
6 |
7 | namespace Pororoca.Desktop.Views;
8 |
9 | public partial class MainWindow : Window
10 | {
11 | // TODO: Avoid using singleton like this
12 | public static MainWindow? Instance;
13 |
14 | public MainWindow()
15 | {
16 | Instance = this;
17 | InitializeComponent();
18 | #if DEBUG
19 | this.AttachDevTools();
20 | #endif
21 | }
22 |
23 | private void InitializeComponent() => AvaloniaXamlLoader.Load(this);
24 |
25 | protected override void OnClosed(EventArgs e)
26 | {
27 | base.OnClosed(e);
28 | TextEditorConfiguration.TextMateInstallations.ForEach(i => i.Item2.Dispose());
29 | }
30 |
31 | public void OnCloseMainWindow(object sender, RoutedEventArgs e) =>
32 | Close();
33 | }
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/Entities/Pororoca/WebSockets/PororocaWebSocketCompressionOptions.cs:
--------------------------------------------------------------------------------
1 | using System.Text.Json.Serialization;
2 |
3 | namespace Pororoca.Domain.Features.Entities.Pororoca.WebSockets;
4 |
5 | public sealed record PororocaWebSocketCompressionOptions
6 | (
7 | [property: JsonInclude] int ClientMaxWindowBits = 15, // range from 9 to 15, default 15
8 | [property: JsonInclude] bool ClientContextTakeover = true, // default true
9 | [property: JsonInclude] int ServerMaxWindowBits = 15, // range from 9 to 15, default 15
10 | [property: JsonInclude] bool ServerContextTakeover = true // default true
11 | )
12 | {
13 | public const int DefaultClientMaxWindowBits = 15;
14 | public const int DefaultServerMaxWindowBits = 15;
15 | public const bool DefaultClientContextTakeover = true;
16 | public const bool DefaultServerContextTakeover = true;
17 |
18 | public PororocaWebSocketCompressionOptions Copy() => this with { };
19 | }
--------------------------------------------------------------------------------
/tests/Pororoca.TestServer/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json.schemastore.org/launchsettings.json",
3 | "iisSettings": {
4 | "windowsAuthentication": false,
5 | "anonymousAuthentication": true,
6 | "iisExpress": {
7 | "applicationUrl": "http://localhost:21880",
8 | "sslPort": 44389
9 | }
10 | },
11 | "profiles": {
12 | "Pororoca.TestServer": {
13 | "commandName": "Project",
14 | "dotnetRunMessages": true,
15 | "launchBrowser": true,
16 | "launchUrl": "swagger",
17 | "applicationUrl": "https://localhost:7208;http://localhost:5230",
18 | "environmentVariables": {
19 | "ASPNETCORE_ENVIRONMENT": "Development"
20 | }
21 | },
22 | "IIS Express": {
23 | "commandName": "IISExpress",
24 | "launchBrowser": true,
25 | "launchUrl": "swagger",
26 | "environmentVariables": {
27 | "ASPNETCORE_ENVIRONMENT": "Development"
28 | }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/tests/Pororoca.Domain.Tests/Features/Common/FileNameUtilsTests.cs:
--------------------------------------------------------------------------------
1 | using Pororoca.Domain.Features.Common;
2 | using Xunit;
3 |
4 | namespace Pororoca.Domain.Tests.Features.Common;
5 |
6 | public static class FileNameUtilsTests
7 | {
8 | [Theory]
9 | [InlineData("xls", "C:\\Folder1\arq1.xls")]
10 | [InlineData("txt", "C:\\Folder1\\Folder2\\arq2.txt")]
11 | [InlineData("jpg", "/usr/bin/img1.jpg")]
12 | [InlineData("jpg", "img1.jpg")]
13 | public static void Should_return_file_extension_without_dot_from_file_path(string expectedFileExtensionWithoutDot, string fileNameOrPath) =>
14 | Assert.Equal(expectedFileExtensionWithoutDot, FileNameUtils.GetFileExtensionWithoutDot(fileNameOrPath));
15 |
16 |
17 | [Theory]
18 | [InlineData("C:\\Folder1\arq1")]
19 | [InlineData("/usr/bin/arq1")]
20 | public static void If_file_does_not_have_extension_then_return_null(string fileNameOrPath) =>
21 | Assert.Null(FileNameUtils.GetFileExtensionWithoutDot(fileNameOrPath));
22 | }
--------------------------------------------------------------------------------
/tests/Pororoca.Domain.Tests/Features/Entities/Pororoca/WebSockets/WebSocketMessageTypeExtensionsTests.cs:
--------------------------------------------------------------------------------
1 | using System.Net.WebSockets;
2 | using Pororoca.Domain.Features.Entities.Pororoca.WebSockets;
3 | using Xunit;
4 |
5 | namespace Pororoca.Domain.Tests.Features.Entities.Pororoca.WebSockets;
6 |
7 | public static class WebSocketMessageTypeExtensionsTests
8 | {
9 |
10 | [Theory]
11 | [InlineData(WebSocketMessageType.Text, PororocaWebSocketMessageType.Text)]
12 | [InlineData(WebSocketMessageType.Close, PororocaWebSocketMessageType.Close)]
13 | [InlineData(WebSocketMessageType.Binary, PororocaWebSocketMessageType.Binary)]
14 | [InlineData(WebSocketMessageType.Binary, (PororocaWebSocketMessageType)11)]
15 | public static void Should_correctly_map_pororoca_ws_msg_type_to_dotnet_ws_msg_type(WebSocketMessageType expectedMappedWsMsgType, PororocaWebSocketMessageType pororocaWsMsgType) =>
16 | Assert.Equal(expectedMappedWsMsgType, pororocaWsMsgType.ToWebSocketMessageType());
17 |
18 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/UITesting/PororocaUITest.cs:
--------------------------------------------------------------------------------
1 | using AlexandreHtrb.AvaloniaUITest;
2 | using Pororoca.Desktop.UserData;
3 | using Pororoca.Desktop.ViewModels;
4 | using Pororoca.Desktop.Views;
5 |
6 | namespace Pororoca.Desktop.UITesting;
7 |
8 | public abstract class PororocaUITest : UITest
9 | {
10 | protected MainWindowViewModel MainWindowVm => ((MainWindowViewModel)MainWindow.Instance!.DataContext!);
11 |
12 | protected override void Teardown()
13 | {
14 | MainWindowVm.CollectionsGroupViewDataCtx.CollectionGroupSelectedItem = null;
15 | MainWindowVm.CollectionsGroupViewDataCtx.Items.Clear();
16 | }
17 |
18 | internal static string GetTestFilesDirPath()
19 | {
20 | var userDataDir = UserDataManager.GetUserDataFolder();
21 | return Path.Combine(userDataDir.FullName, "TestFiles");
22 | }
23 |
24 | protected static string GetTestFilePath(string subFolder, string fileName) =>
25 | Path.Combine(GetTestFilesDirPath(), subFolder, fileName);
26 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop.MacOSX/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleIconFile
6 | pororoca.icns
7 | CFBundleIdentifier
8 | br.alexandrehtrb.pororoca
9 | CFBundleName
10 | Pororoca
11 | CFBundleDisplayName
12 | Pororoca
13 | CFBundleVersion
14 | 3.9.0
15 | CFBundleShortVersionString
16 | 3.9.0
17 | LSMinimumSystemVersion
18 | 10.12
19 | CFBundleExecutable
20 | Pororoca
21 | CFBundleInfoDictionaryVersion
22 | 6.0
23 | CFBundlePackageType
24 | APPL
25 | NSHighResolutionCapable
26 |
27 |
28 |
--------------------------------------------------------------------------------
/tests/Pororoca.TestServer/Configurations/JsonConfiguration.cs:
--------------------------------------------------------------------------------
1 | using System.Text.Encodings.Web;
2 | using System.Text.Json;
3 | using System.Text.Json.Serialization;
4 | using Microsoft.AspNetCore.Http.Json;
5 |
6 | namespace Pororoca.TestServer.Configurations;
7 |
8 | public static class JsonConfiguration
9 | {
10 | public static IServiceCollection ConfigureJsonOptions(this IServiceCollection services) =>
11 | services.Configure(o => SetupExporterImporterJsonOptions(o.SerializerOptions));
12 |
13 | private static JsonSerializerOptions SetupExporterImporterJsonOptions(JsonSerializerOptions options)
14 | {
15 | options.Converters.Add(new JsonStringEnumConverter(JsonNamingPolicy.CamelCase));
16 | options.Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping;
17 | options.WriteIndented = false;
18 | options.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull;
19 | options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
20 | return options;
21 | }
22 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/ViewModels/DataGrids/KeyValueParamsDataGridViewModel.cs:
--------------------------------------------------------------------------------
1 | using Pororoca.Desktop.HotKeys;
2 | using Pororoca.Domain.Features.Entities.Pororoca;
3 |
4 | namespace Pororoca.Desktop.ViewModels.DataGrids;
5 |
6 | public sealed class KeyValueParamsDataGridViewModel : BaseDataGridWithOperationsViewModel
7 | {
8 | public override SimpleClipboardArea InnerClipboardArea =>
9 | KeyValueParamsClipboardArea.Instance;
10 |
11 | public KeyValueParamsDataGridViewModel(List? initialValues = null) : base(initialValues)
12 | {
13 | }
14 |
15 | protected override KeyValueParamViewModel ToVm(PororocaKeyValueParam domainObj) =>
16 | new(Items, domainObj);
17 |
18 | protected override PororocaKeyValueParam ToDomain(KeyValueParamViewModel viewModel) =>
19 | viewModel.ToKeyValueParam();
20 |
21 | protected override PororocaKeyValueParam MakeCopy(PororocaKeyValueParam domainObj) =>
22 | domainObj.Copy();
23 | }
--------------------------------------------------------------------------------
/tests/Pororoca.Test.Tests/TestFilesLoader.cs:
--------------------------------------------------------------------------------
1 | global using static Pororoca.Test.Tests.TestFilesLoader;
2 |
3 | namespace Pororoca.Test.Tests;
4 |
5 | internal static class TestFilesLoader
6 | {
7 | internal static string GetTestCollectionFilePath()
8 | {
9 | var testDataDirInfo = new DirectoryInfo(Environment.CurrentDirectory).Parent!.Parent!.Parent!;
10 | return Path.Combine(testDataDirInfo.FullName, "PororocaIntegrationTestCollection.pororoca_collection.json");
11 | }
12 |
13 | internal static string GetTestClientCertificatesDir()
14 | {
15 | var testDataDirInfo = new DirectoryInfo(Environment.CurrentDirectory).Parent!.Parent!.Parent!.Parent!;
16 | return Path.Combine(testDataDirInfo.FullName, "TestFiles", "ClientCertificates");
17 | }
18 |
19 | internal static string GetTestFilesDir()
20 | {
21 | var testDataDirInfo = new DirectoryInfo(Environment.CurrentDirectory).Parent!.Parent!.Parent!.Parent!;
22 | return Path.Combine(testDataDirInfo.FullName, "TestFiles");
23 | }
24 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/UITesting/Robots/CollectionRobot.cs:
--------------------------------------------------------------------------------
1 | using Pororoca.Desktop.Controls;
2 | using Pororoca.Desktop.Views;
3 |
4 | namespace Pororoca.Desktop.UITesting.Robots;
5 |
6 | public sealed class CollectionRobot : BaseNamedRobot
7 | {
8 | public CollectionRobot(CollectionView rootView) : base(rootView) { }
9 |
10 | internal IconButton AddFolder => GetChildView("btAddFolder")!;
11 | internal IconButton AddHttpReq => GetChildView("btAddHttpReq")!;
12 | internal IconButton AddWebSocket => GetChildView("btAddWebSocket")!;
13 | internal IconButton AddRepeater => GetChildView("btAddHttpRep")!;
14 | internal IconButton SetCollectionScopedReqHeaders => GetChildView("btSetColScopedReqHeaders")!;
15 | internal IconButton AddEnvironment => GetChildView("btAddEnvironment")!;
16 | internal IconButton ImportEnvironment => GetChildView("btImportEnv")!;
17 | internal IconButton ExportCollection => GetChildView("btExportCollection")!;
18 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/UITesting/Tests/HttpRequests/BearerAuth.cs:
--------------------------------------------------------------------------------
1 | namespace Pororoca.Desktop.UITesting.Tests;
2 |
3 | public sealed partial class HttpRequestsUITest : PororocaUITest
4 | {
5 | private async Task TestBearerAuth()
6 | {
7 | await HttpRobot.HttpMethod.Select("GET");
8 | await HttpRobot.Url.ClearAndTypeText("{{BaseUrl}}/test/auth");
9 | await HttpRobot.SetEmptyBody();
10 | await HttpRobot.SetBearerAuth("{{BearerAuthToken}}");
11 | await HttpRobot.ClickOnSendAndWaitForResponse();
12 |
13 | HttpRobot.ResTitle.AssertContainsText("Response: 200 OK");
14 | await HttpRobot.TabControlRes.Select(HttpRobot.TabResHeaders);
15 | AssertContainsResponseHeader("Date");
16 | AssertContainsResponseHeader("Server", "Kestrel");
17 | AssertContainsResponseHeader("Content-Type", "text/plain; charset=utf-8");
18 | await HttpRobot.TabControlRes.Select(HttpRobot.TabResBody);
19 | HttpRobot.ResBodyRawContent.AssertHasText("Bearer token_local");
20 | HttpRobot.ResBodySaveToFile.AssertIsVisible();
21 | }
22 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/UITesting/Tests/HttpRequests/GetJsonResponse.cs:
--------------------------------------------------------------------------------
1 | namespace Pororoca.Desktop.UITesting.Tests;
2 |
3 | public sealed partial class HttpRequestsUITest : PororocaUITest
4 | {
5 | private async Task TestGetJsonResponse()
6 | {
7 | await HttpRobot.HttpMethod.Select("GET");
8 | await HttpRobot.Url.ClearAndTypeText("{{BaseUrl}}/test/get/json");
9 | await HttpRobot.SetEmptyBody();
10 | await HttpRobot.ClickOnSendAndWaitForResponse();
11 |
12 | HttpRobot.ResTitle.AssertContainsText("Response: 200 OK");
13 | await HttpRobot.TabControlRes.Select(HttpRobot.TabResHeaders);
14 | AssertContainsResponseHeader("Date");
15 | AssertContainsResponseHeader("Server", "Kestrel");
16 | AssertContainsResponseHeader("Content-Type", "application/json; charset=utf-8");
17 | await HttpRobot.TabControlRes.Select(HttpRobot.TabResBody);
18 | HttpRobot.ResBodyRawContent.AssertHasText("{" + Environment.NewLine + " \"id\": 1" + Environment.NewLine + "}");
19 | HttpRobot.ResBodySaveToFile.AssertIsVisible();
20 | }
21 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Controls.ApplicationLifetimes;
3 | using Avalonia.Markup.Xaml;
4 | using Pororoca.Desktop.UserData;
5 | using Pororoca.Desktop.ViewModels;
6 | using Pororoca.Desktop.Views;
7 |
8 | namespace Pororoca.Desktop;
9 |
10 | public sealed class App : Application
11 | {
12 | public override void Initialize() =>
13 | AvaloniaXamlLoader.Load(this);
14 |
15 | public override void OnFrameworkInitializationCompleted()
16 | {
17 | LoadInitialTheme();
18 |
19 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
20 | {
21 | desktop.MainWindow = new MainWindow
22 | {
23 | DataContext = new MainWindowViewModel(),
24 | };
25 | }
26 |
27 | base.OnFrameworkInitializationCompleted();
28 | }
29 |
30 | private void LoadInitialTheme()
31 | {
32 | var initialTheme = UserDataManager.LoadUserPreferences()?.Theme ?? PororocaThemeManager.DefaultTheme;
33 | PororocaThemeManager.CurrentTheme = initialTheme;
34 | }
35 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/UITesting/Tests/HttpRequests/BasicAuth.cs:
--------------------------------------------------------------------------------
1 | namespace Pororoca.Desktop.UITesting.Tests;
2 |
3 | public sealed partial class HttpRequestsUITest : PororocaUITest
4 | {
5 | private async Task TestBasicAuth()
6 | {
7 | await HttpRobot.HttpMethod.Select("GET");
8 | await HttpRobot.Url.ClearAndTypeText("{{BaseUrl}}/test/auth");
9 | await HttpRobot.SetEmptyBody();
10 | await HttpRobot.SetBasicAuth("{{BasicAuthLogin}}", "{{BasicAuthPassword}}");
11 | await HttpRobot.ClickOnSendAndWaitForResponse();
12 |
13 | HttpRobot.ResTitle.AssertContainsText("Response: 200 OK");
14 | await HttpRobot.TabControlRes.Select(HttpRobot.TabResHeaders);
15 | AssertContainsResponseHeader("Date");
16 | AssertContainsResponseHeader("Server", "Kestrel");
17 | AssertContainsResponseHeader("Content-Type", "text/plain; charset=utf-8");
18 | await HttpRobot.TabControlRes.Select(HttpRobot.TabResBody);
19 | HttpRobot.ResBodyRawContent.AssertHasText("Basic dXNyOnB3ZA==");
20 | HttpRobot.ResBodySaveToFile.AssertIsVisible();
21 | }
22 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/UITesting/Tests/HttpRequests/GetBinaryResponse.cs:
--------------------------------------------------------------------------------
1 | namespace Pororoca.Desktop.UITesting.Tests;
2 |
3 | public sealed partial class HttpRequestsUITest : PororocaUITest
4 | {
5 | private async Task TestGetBinaryResponse()
6 | {
7 | await HttpRobot.HttpMethod.Select("GET");
8 | await HttpRobot.Url.ClearAndTypeText("{{BaseUrl}}/test/get/img");
9 | await HttpRobot.SetEmptyBody();
10 | await HttpRobot.ClickOnSendAndWaitForResponse();
11 |
12 | HttpRobot.ResTitle.AssertContainsText("Response: 200 OK");
13 | await HttpRobot.TabControlRes.Select(HttpRobot.TabResHeaders);
14 | AssertContainsResponseHeader("Date");
15 | AssertContainsResponseHeader("Server", "Kestrel");
16 | AssertContainsResponseHeader("Content-Type", "image/gif");
17 | AssertContainsResponseHeader("Content-Length", "888");
18 | await HttpRobot.TabControlRes.Select(HttpRobot.TabResBody);
19 | HttpRobot.ResBodyRawContent.AssertContainsText("(binary content not shown, 888 bytes)");
20 | HttpRobot.ResBodySaveToFile.AssertIsVisible();
21 | }
22 | }
--------------------------------------------------------------------------------
/tests/Pororoca.Domain.Tests/TestFilesLoader.cs:
--------------------------------------------------------------------------------
1 | global using static Pororoca.Domain.Tests.TestFilesLoader;
2 | global using static Pororoca.Domain.Features.Common.JsonUtils;
3 |
4 | using System.Text;
5 |
6 | namespace Pororoca.Domain.Tests;
7 |
8 | internal static class TestFilesLoader
9 | {
10 | internal static string GetTestFilesDirPath()
11 | {
12 | var testDataDirInfo = new DirectoryInfo(Environment.CurrentDirectory).Parent!.Parent!.Parent!;
13 | return Path.Combine(testDataDirInfo.FullName, "TestData");
14 | }
15 |
16 | internal static string GetTestFilePath(string fileName) =>
17 | Path.Combine(GetTestFilesDirPath(), fileName);
18 |
19 | internal static string ReadTestFileText(string fileName)
20 | {
21 | string path = GetTestFilePath(fileName);
22 | return File.ReadAllText(path, Encoding.UTF8);
23 | }
24 |
25 | internal static string ReadTestFileText(string subfolder, string fileName)
26 | {
27 | string path = Path.Combine(GetTestFilesDirPath(), subfolder, fileName);
28 | return File.ReadAllText(path, Encoding.UTF8);
29 | }
30 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/UITesting/Tests/HttpRequests/GetTextResponse.cs:
--------------------------------------------------------------------------------
1 | namespace Pororoca.Desktop.UITesting.Tests;
2 |
3 | public sealed partial class HttpRequestsUITest : PororocaUITest
4 | {
5 | private async Task TestGetTextResponse()
6 | {
7 | await HttpRobot.HttpMethod.Select("GET");
8 | await HttpRobot.Url.ClearAndTypeText("{{BaseUrl}}/test/get/txt");
9 | await HttpRobot.SetEmptyBody();
10 | await HttpRobot.ClickOnSendAndWaitForResponse();
11 |
12 | HttpRobot.ResTitle.AssertContainsText("Response: 200 OK");
13 | await HttpRobot.TabControlRes.Select(HttpRobot.TabResHeaders);
14 | AssertContainsResponseHeader("Date");
15 | AssertContainsResponseHeader("Server", "Kestrel");
16 | AssertContainsResponseHeader("Content-Length");
17 | AssertContainsResponseHeader("Content-Disposition", "attachment; filename=ascii.txt; filename*=UTF-8''ascii.txt");
18 | await HttpRobot.TabControlRes.Select(HttpRobot.TabResBody);
19 | HttpRobot.ResBodyRawContent.AssertContainsText("Cross-Stitch Pattern");
20 | HttpRobot.ResBodySaveToFile.AssertIsVisible();
21 | }
22 | }
--------------------------------------------------------------------------------
/src/Pororoca.Domain/Features/RequestRepeater/TranslateRepetitionErrors.cs:
--------------------------------------------------------------------------------
1 | namespace Pororoca.Domain.Features.RequestRepeater;
2 |
3 | public static class TranslateRepetitionErrors
4 | {
5 | public const string BaseHttpRequestNotSelected = "TranslateRepetition_BaseHttpRequestNotSelected";
6 | public const string BaseHttpRequestNotFound = "TranslateRepetition_BaseHttpRequestNotFound";
7 | public const string DelayCantBeNegative = "TranslateRepetition_DelayCantBeNegative";
8 | public const string MaximumRateCantBeNegative = "TranslateRepetition_MaximumRateCantBeNegative";
9 | public const string NumberOfRepetitionsMustBeAtLeast1 = "TranslateRepetition_NumberOfRepetitionsMustBeAtLeast1";
10 | public const string MaxDopMustBeAtLeast1 = "TranslateRepetition_MaxDopMustBeAtLeast1";
11 | public const string InputDataFileNotFound = "TranslateRepetition_InputDataFileNotFound";
12 | public const string InputDataInvalid = "TranslateRepetition_InputDataInvalid";
13 | public const string InputDataAtLeastOneLine = "TranslateRepetition_InputDataAtLeastOneLine";
14 | public const string UnknownError = "TranslateRepetition_UnknownError";
15 | }
--------------------------------------------------------------------------------
/src/ReactiveUIFody_licence.txt:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Simon Cropp
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/tests/Pororoca.Domain.Tests/Features/ImportEnvironment/PororocaEnvironmentImporterTests.cs:
--------------------------------------------------------------------------------
1 | using Xunit;
2 | using static Pororoca.Domain.Features.ImportEnvironment.PororocaEnvironmentImporter;
3 |
4 | namespace Pororoca.Domain.Tests.Features.ImportEnvironment;
5 |
6 | public static class PororocaEnvironmentImporterTests
7 | {
8 |
9 | [Fact]
10 | public static void Should_import_valid_pororoca_environment_correctly()
11 | {
12 | // GIVEN
13 | string json = ReadTestFileText("EmptyEnvironment.pororoca_environment.json");
14 |
15 | // WHEN AND THEN
16 | Assert.True(TryImportPororocaEnvironment(json, out var env));
17 |
18 | // THEN
19 | Assert.NotNull(env);
20 | Assert.NotEqual(Guid.Parse("eb19683a-3676-4564-9daf-a711661c0862"), env!.Id);
21 | Assert.Equal(DateTimeOffset.Parse("2022-03-03T22:07:56.1967358-03:00"), env.CreatedAt);
22 | Assert.Equal("Novo ambiente", env.Name);
23 | Assert.False(env.IsCurrent); // Must always be non current environment, despite what is in JSON
24 | Assert.NotNull(env.Variables);
25 | Assert.Empty(env.Variables);
26 | }
27 | }
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0.0",
3 | "tasks": [
4 | {
5 | "label": "buildDesktop",
6 | "command": "dotnet",
7 | "type": "process",
8 | "args": [
9 | "build",
10 | "${workspaceFolder}/src/Pororoca.Desktop/Pororoca.Desktop.csproj",
11 | "/property:GenerateFullPaths=true",
12 | // uncomment line below to debug windows installed version
13 | //"/property:PublishForInstallOnWindows=true",
14 | "/consoleloggerparameters:NoSummary"
15 | ],
16 | "problemMatcher": "$msCompile"
17 | },
18 | {
19 | "label": "buildTestServer",
20 | "command": "dotnet",
21 | "type": "process",
22 | "args": [
23 | "build",
24 | "${workspaceFolder}/tests/Pororoca.TestServer/Pororoca.TestServer.csproj",
25 | "/property:GenerateFullPaths=true",
26 | "/consoleloggerparameters:NoSummary"
27 | ],
28 | "problemMatcher": "$msCompile"
29 | }
30 | ]
31 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Converters/ExportCollectionFormatConverters.cs:
--------------------------------------------------------------------------------
1 | namespace Pororoca.Desktop.Converters;
2 |
3 | public enum ExportCollectionFormat
4 | {
5 | Pororoca = 0,
6 | Postman = 1
7 | }
8 |
9 | internal static class ExportCollectionFormatMapping
10 | {
11 | internal static ExportCollectionFormat MapIndexToEnum(int index) =>
12 | index switch
13 | {
14 | 0 => ExportCollectionFormat.Pororoca,
15 | 1 => ExportCollectionFormat.Postman,
16 | _ => ExportCollectionFormat.Pororoca
17 | };
18 |
19 | internal static int MapEnumToIndex(ExportCollectionFormat? type) =>
20 | type switch
21 | { // TODO: Improve this, do not use fixed integers to resolve mode
22 | ExportCollectionFormat.Pororoca => 0,
23 | ExportCollectionFormat.Postman => 1,
24 | _ => 0
25 | };
26 | }
27 |
28 | public sealed class ExportCollectionFormatMatchConverter : EnumMatchConverter
29 | {
30 | protected override ExportCollectionFormat? MapIndexToEnum(int index) =>
31 | ExportCollectionFormatMapping.MapIndexToEnum(index);
32 | }
--------------------------------------------------------------------------------
/src/AvaloniaEdit_licence.txt:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Eli Arbel
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/UITesting/Tests/HttpRequests/PostJson.cs:
--------------------------------------------------------------------------------
1 | namespace Pororoca.Desktop.UITesting.Tests;
2 |
3 | public sealed partial class HttpRequestsUITest : PororocaUITest
4 | {
5 | private async Task TestPostRawJsonBody()
6 | {
7 | await HttpRobot.HttpMethod.Select("POST");
8 | await HttpRobot.Url.ClearAndTypeText("{{BaseUrl}}/test/post/json");
9 | await HttpRobot.SetRawBody("application/json", "{\"myValue\":\"{{SpecialValue1}}\"}");
10 | await HttpRobot.ClickOnSendAndWaitForResponse();
11 |
12 | HttpRobot.ResTitle.AssertContainsText("Response: 200 OK");
13 | await HttpRobot.TabControlRes.Select(HttpRobot.TabResHeaders);
14 | AssertContainsResponseHeader("Date");
15 | AssertContainsResponseHeader("Server", "Kestrel");
16 | AssertContainsResponseHeader("Content-Type", "application/json; charset=utf-8");
17 | await HttpRobot.TabControlRes.Select(HttpRobot.TabResBody);
18 | HttpRobot.ResBodyRawContent.AssertHasText("{" + Environment.NewLine + " \"myValue\": \"Tailândia\"" + Environment.NewLine + "}");
19 | HttpRobot.ResBodySaveToFile.AssertIsVisible();
20 | }
21 | }
--------------------------------------------------------------------------------
/src/TextMateSharp_licence.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Daniel Peñalba
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/Converters/ExportEnvironmentFormatConverters.cs:
--------------------------------------------------------------------------------
1 | namespace Pororoca.Desktop.Converters;
2 |
3 | public enum ExportEnvironmentFormat
4 | {
5 | Pororoca = 0,
6 | Postman = 1
7 | }
8 |
9 | internal static class ExportEnvironmentFormatMapping
10 | {
11 | internal static ExportEnvironmentFormat MapIndexToEnum(int index) =>
12 | index switch
13 | {
14 | 0 => ExportEnvironmentFormat.Pororoca,
15 | 1 => ExportEnvironmentFormat.Postman,
16 | _ => ExportEnvironmentFormat.Pororoca
17 | };
18 |
19 | internal static int MapEnumToIndex(ExportEnvironmentFormat? type) =>
20 | type switch
21 | { // TODO: Improve this, do not use fixed integers to resolve mode
22 | ExportEnvironmentFormat.Pororoca => 0,
23 | ExportEnvironmentFormat.Postman => 1,
24 | _ => 0
25 | };
26 | }
27 |
28 | public sealed class ExportEnvironmentFormatMatchConverter : EnumMatchConverter
29 | {
30 | protected override ExportEnvironmentFormat? MapIndexToEnum(int index) =>
31 | ExportEnvironmentFormatMapping.MapIndexToEnum(index);
32 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/UITesting/PororocaUITestAssertions.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using AvaloniaEdit;
3 | using Pororoca.Desktop.Views;
4 |
5 | namespace Pororoca.Desktop.UITesting;
6 |
7 | public static class PororocaUITestAssertions
8 | {
9 | public static void AssertHasText(this TextEditor txtEditor, string txt) => AssertCondition(txtEditor.Document.Text == txt);
10 |
11 | public static void AssertContainsText(this TextEditor txtEditor, string txt) => AssertCondition(txtEditor.Document.Text.Contains(txt));
12 |
13 | public static void AssertTreeItemExists(this CollectionsGroupView cgv, string itemPathSeparatedBySlashes)
14 | {
15 | var treeView = cgv.FindControl("itemsTree")!;
16 | object? item = treeView.GetChildView(itemPathSeparatedBySlashes);
17 | AssertCondition(item is not null);
18 | }
19 |
20 | public static void AssertTreeItemNotExists(this CollectionsGroupView cgv, string itemPathSeparatedBySlashes)
21 | {
22 | var treeView = cgv.FindControl("itemsTree")!;
23 | object? item = treeView.GetChildView(itemPathSeparatedBySlashes);
24 | AssertCondition(item is null);
25 | }
26 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/UITesting/Robots/EditableTextBlockRobot.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using Pororoca.Desktop.Controls;
3 | using Pororoca.Desktop.Converters;
4 | using Pororoca.Desktop.ViewModels;
5 |
6 | namespace Pororoca.Desktop.UITesting.Robots;
7 |
8 | public sealed class EditableTextBlockRobot : BaseRobot
9 | {
10 | public EditableTextBlockRobot(EditableTextBlock rootView) : base(rootView) { }
11 |
12 | internal EditableTextBlockIcon? Icon => ((EditableTextBlockViewModel)RootView.DataContext!).Icon;
13 | internal TextBlock AppliedText => GetChildView("tbText")!;
14 | internal TextBox TextBeingEdited => GetChildView("txtBox")!;
15 | internal Button ButtonEditOrApply => GetChildView TLS handshake", res.GetBodyAsPrettyText());
43 | }
44 | }
--------------------------------------------------------------------------------
/tests/Pororoca.TestServer/Endpoints/MultipartResult.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.ObjectModel;
2 |
3 | namespace Pororoca.TestServer.Endpoints;
4 |
5 | #nullable disable warnings
6 | public sealed class MultipartContent
7 | {
8 | public string Name { get; set; }
9 |
10 | public string ContentType { get; set; }
11 |
12 | public string? FileName { get; set; }
13 |
14 | public Stream Stream { get; set; }
15 | }
16 | #nullable restore warnings
17 |
18 | public sealed class MultipartFormDataResult : Collection, IResult
19 | {
20 | private readonly MultipartFormDataContent content;
21 |
22 | public MultipartFormDataResult(string? boundary = null) =>
23 | this.content = new(boundary ?? Guid.NewGuid().ToString());
24 |
25 | public async Task ExecuteAsync(HttpContext context)
26 | {
27 | foreach (var item in this)
28 | {
29 | if (item.Stream != null)
30 | {
31 | var content = new StreamContent(item.Stream);
32 |
33 | if (item.ContentType != null)
34 | {
35 | content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(item.ContentType);
36 | }
37 |
38 | content.Headers.ContentDisposition = new("form-data");
39 | content.Headers.ContentDisposition.Name = item.Name;
40 |
41 | if (item.FileName != null)
42 | {
43 | content.Headers.ContentDisposition.FileName = item.FileName;
44 | }
45 |
46 | this.content.Add(content);
47 | }
48 | }
49 |
50 | context.Response.ContentLength = this.content.Headers.ContentLength;
51 | context.Response.ContentType = this.content.Headers.ContentType?.ToString();
52 |
53 | await this.content.CopyToAsync(context.Response.Body);
54 | this.content.Dispose();
55 | }
56 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/ViewModels/HttpRepetitionResultViewModel.cs:
--------------------------------------------------------------------------------
1 | using System.Net;
2 | using Pororoca.Desktop.Localization;
3 | using Pororoca.Domain.Features.Entities.Pororoca.Repetition;
4 | using ReactiveUI.Fody.Helpers;
5 | using static Pororoca.Domain.Features.Common.HttpStatusCodeFormatter;
6 |
7 | namespace Pororoca.Desktop.ViewModels;
8 |
9 | public sealed class HttpRepetitionResultViewModel : ViewModelBase
10 | {
11 | [Reactive]
12 | public int IterationNumber { get; set; }
13 |
14 | [Reactive]
15 | public string ErrorDescriptionOrStatusCode { get; set; }
16 |
17 | [Reactive]
18 | public bool Successful { get; set; }
19 |
20 | public PororocaHttpRepetitionResult Result { get; }
21 |
22 | internal HttpRepetitionResultViewModel(int iterationNumber, PororocaHttpRepetitionResult result)
23 | {
24 | IterationNumber = iterationNumber;
25 | Result = result;
26 | long? elapsedTimeInMilliseconds = result.Response?.ElapsedTime is null ? null : (long)result.Response.ElapsedTime.TotalMilliseconds;
27 | if (result.Successful)
28 | {
29 | Successful = true;
30 | var statusCode = (HttpStatusCode)result.Response!.StatusCode!;
31 | ErrorDescriptionOrStatusCode = FormatHttpStatusCodeText(statusCode) + $" ({(long)elapsedTimeInMilliseconds!}ms)";
32 | }
33 | else
34 | {
35 | Successful = false;
36 | string errorMsg = result.ValidationErrorCode ??
37 | ((result.Response?.Exception is TaskCanceledException || result.Response?.Exception is OperationCanceledException) ?
38 | Localizer.Instance.HttpRepeater.RepetitionResultCancelled :
39 | Localizer.Instance.HttpRepeater.RepetitionResultException);
40 | ErrorDescriptionOrStatusCode = elapsedTimeInMilliseconds is null ? errorMsg : $"{errorMsg} ({(long)elapsedTimeInMilliseconds!}ms)";
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/UITesting/Tests/HttpRequests/CaptureResponseHeader.cs:
--------------------------------------------------------------------------------
1 | namespace Pororoca.Desktop.UITesting.Tests;
2 |
3 | public sealed partial class ResponseCapturesUITest : PororocaUITest
4 | {
5 | private async Task TestCaptureResponseHeader(bool saveCapturesInCurrentEnvironment)
6 | {
7 | await HttpRobot.HttpMethod.Select("GET");
8 | await HttpRobot.Url.ClearAndTypeText("{{BaseUrl}}/test/get/headers");
9 | await HttpRobot.SetEmptyBody();
10 | await HttpRobot.TabControlReq.Select(HttpRobot.TabReqHeaders);
11 | await HttpRobot.SetRequestHeaders(
12 | [
13 | new(true, "Header1", "oi"),
14 | ]);
15 | await HttpRobot.TabControlRes.Select(HttpRobot.TabResCapture);
16 | await HttpRobot.ResAddCaptureHeader.ClickOn();
17 | await HttpRobot.EditResponseCaptureAt(0, "MyCapturedHeaderValue", "MIRRORED-Header1");
18 | await HttpRobot.ClickOnSendAndWaitForResponse();
19 |
20 | var capture = HttpRobot.ResCapturesVm.Items[0];
21 | AssertCondition(capture.CapturedValue == "oi");
22 |
23 | if (saveCapturesInCurrentEnvironment)
24 | {
25 | await TreeRobot.Select("COL1/ENVS/ENV1");
26 | var targetVar = EnvRobot.VariablesVm.Items.First(x => x.Key == "MyCapturedHeaderValue");
27 | AssertCondition(targetVar.Value == "oi");
28 | AssertCondition(targetVar.IsSecret == true);
29 | targetVar.RemoveVariable();
30 | }
31 | else
32 | {
33 | await TreeRobot.Select("COL1/VARS");
34 | var targetVar = ColVarsRobot.VariablesVm.Items.First(x => x.Key == "MyCapturedHeaderValue");
35 | AssertCondition(targetVar.Value == "oi");
36 | AssertCondition(targetVar.IsSecret == true);
37 | targetVar.RemoveVariable();
38 | }
39 |
40 | await TreeRobot.Select("COL1/HTTPREQ");
41 | HttpRobot.ResCapturesVm.Items.Clear();
42 | }
43 | }
--------------------------------------------------------------------------------
/src/Pororoca.Infrastructure/Features/WebSockets/WebSocketClientSideConnector.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.Net;
3 | using System.Net.WebSockets;
4 |
5 | namespace Pororoca.Infrastructure.Features.WebSockets;
6 |
7 | public class WebSocketClientSideConnector : WebSocketConnector
8 | {
9 | protected override WebSocketMessageDirection DirectionFromThis => WebSocketMessageDirection.FromClient;
10 |
11 | public HttpStatusCode ConnectionHttpStatusCode { get; private set; }
12 |
13 | public IReadOnlyDictionary>? ConnectionHttpHeaders { get; private set; }
14 |
15 | public TimeSpan ElapsedConnectionTimeSpan { get; private set; }
16 |
17 | #region CONNECTION
18 |
19 | public async Task ConnectAsync(ClientWebSocket ws, HttpClient httpClient, Uri uri, CancellationToken cancellationToken = default)
20 | {
21 | if (ConnectionState == WebSocketConnectorState.Connected || ConnectionState == WebSocketConnectorState.Connecting)
22 | return; // Not throwing exception if user tried to connect whilst WebSocket is connected
23 |
24 | Stopwatch sw = new();
25 | try
26 | {
27 | SetIsConnecting();
28 | sw.Start();
29 | await ws.ConnectAsync(uri!, httpClient, cancellationToken);
30 | sw.Stop();
31 | SetupAfterConnected(ws, sw.Elapsed);
32 | SetIsConnected();
33 | }
34 | catch (Exception ex)
35 | {
36 | SetIsDisconnected(ex);
37 | }
38 | }
39 |
40 | private void SetupAfterConnected(ClientWebSocket ws, TimeSpan elapsedConnectionTimeSpan)
41 | {
42 | this.ws = ws;
43 | base.SetupAfterConnected();
44 |
45 | ConnectionHttpStatusCode = ((ClientWebSocket)this.ws).HttpStatusCode;
46 | ConnectionHttpHeaders = ((ClientWebSocket)this.ws).HttpResponseHeaders;
47 | ElapsedConnectionTimeSpan = elapsedConnectionTimeSpan;
48 | }
49 |
50 | #endregion
51 | }
--------------------------------------------------------------------------------
/src/Pororoca.Desktop/UITesting/Tests/TopMenuUITest.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using Pororoca.Desktop.UITesting.Robots;
3 | using Pororoca.Desktop.Views;
4 |
5 | namespace Pororoca.Desktop.UITesting.Tests;
6 |
7 | public sealed class TopMenuUITest : PororocaUITest
8 | {
9 | private TopMenuRobot Robot { get; }
10 |
11 | public TopMenuUITest()
12 | {
13 | object? content = MainWindow.Instance!.Content;
14 | Robot = new((Control)content!);
15 | }
16 |
17 | public override async Task RunAsync()
18 | {
19 | Robot.File.AssertIsVisible();
20 | Robot.Options.AssertIsVisible();
21 | Robot.Help.AssertIsVisible();
22 |
23 | await Robot.File.ClickOn();
24 | // for some reason, this needs to be repeated (???),
25 | // otherwise the menu item won't expand
26 | await Robot.File.ClickOn();
27 | Robot.File_NewCollection.AssertIsVisible();
28 | Robot.File_ImportCollectionsFromFile.AssertIsVisible();
29 | Robot.File_Exit.AssertIsVisible();
30 |
31 | await Robot.Options.ClickOn();
32 | Robot.File_Exit.AssertIsHidden();
33 | Robot.Options_Theme.AssertIsVisible();
34 | Robot.Options_Language.AssertIsVisible();
35 | Robot.Options_EnableTlsVerification.AssertIsVisible();
36 |
37 | await Robot.Options_Theme.ClickOn();
38 | Robot.Options_Theme_Light.AssertIsVisible();
39 | Robot.Options_Theme_Light2.AssertIsVisible();
40 | Robot.Options_Theme_Dark.AssertIsVisible();
41 | Robot.Options_Theme_Pampa.AssertIsVisible();
42 | Robot.Options_Theme_AmazonianNight.AssertIsVisible();
43 |
44 | await Robot.Options_Language.ClickOn();
45 | Robot.Options_Theme_Light.AssertIsHidden();
46 | Robot.Options_Language_English.AssertIsVisible();
47 | Robot.Options_Language_Português.AssertIsVisible();
48 | Robot.Options_Language_Russian.AssertIsVisible();
49 |
50 | //await Robot.Help.ClickOn();
51 | }
52 | }
--------------------------------------------------------------------------------