HttpRepl
HttpRepl copied to clipboard
FileNotFoundException when using `post -h Content-Type=application/json`
I'm following the MS Docs guide for httprepl.
Here is my session with the tool
(Disconnected)> connect https://localhost:7063/
Using a base address of https://localhost:7063/
Unable to find an OpenAPI description
For detailed tool info, see https://aka.ms/http-repl-doc
https://localhost:7063/> ls
No directory structure has been set, so there is nothing to list. Use the "connect" command to set a directory structure based on an OpenAPI description.
https://localhost:7063/> cd api/author
https://localhost:7063/api/author> cd token
https://localhost:7063/api/author/token> post -h Content-Type=application/json
The default editor must be configured using the command `pref set editor.command.default "{commandLine}"`.
https://localhost:7063/api/author/token> pref set editor.command.default "C:\Program Files\EditPlus\editplus.exe"
https://localhost:7063/api/author/token> post -h Content-Type=application/json
System.IO.FileNotFoundException: Could not find file 'C:\Users\Vlad\AppData\Local\Temp\HttpRepl.373bdef6-8365-43f9-adc2-8eba3c0ff887.json'.
File name: 'C:\Users\Vlad\AppData\Local\Temp\HttpRepl.373bdef6-8365-43f9-adc2-8eba3c0ff887.json'
at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
at System.IO.Strategies.SyncWindowsFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.File.ReadAllBytes(String path)
at Microsoft.HttpRepl.FileSystem.RealFileSystem.ReadAllBytesFromFile(String path) in /_/src/Microsoft.HttpRepl/FileSystem/RealFileSystem.cs:line 27
at Microsoft.HttpRepl.Commands.BaseHttpCommand.HandleRequiresBody(DefaultCommandInput`1 commandInput, IShellState shellState, HttpState programState, HttpRequestMessage request, Dictionary`2 requestHeaders) in /_/src/Microsoft.HttpRepl/Commands/BaseHttpCommand.cs:line 296
at Microsoft.HttpRepl.Commands.BaseHttpCommand.ExecuteAsync(IShellState shellState, HttpState programState, DefaultCommandInput`1 commandInput, ICoreParseResult parseResult, CancellationToken cancellationToken) in /_/src/Microsoft.HttpRepl/Commands/BaseHttpCommand.cs:line 140
at Microsoft.Repl.Commanding.DefaultCommandDispatcher`2.ExecuteCommandInternalAsync(IShellState shellState, CancellationToken cancellationToken) in /_/src/Microsoft.Repl/Commanding/DefaultCommandDispatcher.cs:line 155
at Microsoft.Repl.Commanding.DefaultCommandDispatcher`2.ExecuteCommandAsync(IShellState shellState, CancellationToken cancellationToken) in /_/src/Microsoft.Repl/Commanding/DefaultCommandDispatcher.cs:line 118
I don't quite understand why the app can't create the required file. Am I supposed to run this tool in elevated mode? Am I missing something?
It looks like the problem is the text editor setting. But I can't make it work with Notepad either.
What text editors are supported by HttpRepl? And what would be preferred settings for Notepad?