Coding Shorts: Sharing Variables in .http Files

  Рет қаралды 1,447

Shawn Wildermuth

Shawn Wildermuth

Күн бұрын

Пікірлер: 27
@Kingside88
@Kingside88 5 ай бұрын
Thank you. I learned the "user" part of it. It would be great if somehow it could be possible to get the bearer token by login into identity provider. And then share it across http files
@swildermuth
@swildermuth 5 ай бұрын
Yeah, I still have to run the web app and steal the token.
@grumpydeveloper69
@grumpydeveloper69 5 ай бұрын
Just like the VS Code Rest Client plugin
@pilotboba
@pilotboba 5 ай бұрын
It would be nice if it could integrate with the dotnet configuration system as well as the user configuration specified in the project so that you can pull those secrets or user level totally out of the project folder.
@swildermuth
@swildermuth 5 ай бұрын
It would. You can always do a PR!
@microtech2448
@microtech2448 2 ай бұрын
Hi, did you find a way to set env variable once you have the result from API, just like in postman. An instance can be, you call login api and get the token, anyone would want to save it automatically in the env variable instead of manually copy paste it.
@swildermuth
@swildermuth 2 ай бұрын
Yes, in Visual Studio, you can create an environment (see upper right hand corner drop-down) that is used by any http files that choose that environment.
@LindenMikus
@LindenMikus 5 ай бұрын
would be cool if there was a way to convert existing postman collections and environments to these type of files
@swildermuth
@swildermuth 5 ай бұрын
Since these files are *just* text files of the actual requests, I bet it wouldn't be too tough.
@torkilpedersen5014
@torkilpedersen5014 5 ай бұрын
Like the length of our presentations☺
@swildermuth
@swildermuth 5 ай бұрын
Glad you like them!
@DannyHille
@DannyHille 5 ай бұрын
Neat trick - Thanks 🙂
@swildermuth
@swildermuth 5 ай бұрын
Glad you liked it!
@roa71
@roa71 5 ай бұрын
Thanks. Why moving on from Postman? Better integration with VS or other reasons? Just curious..
@Kingside88
@Kingside88 5 ай бұрын
Because you dont want to have multiple apps open while coding
@pilotboba
@pilotboba 5 ай бұрын
A couple of reasons. you can check in the files right next to your code. You can stay in the same app to do tests. Granted you can store a Postman collection in your repo, but its a few manual steps, vs checkout and go, add one, commit, and everyone else gets the new HTTP files to use with your new endpoints.
@pilotboba
@pilotboba 5 ай бұрын
That said, it doesn't really replace Postman or Insomnia, they have a lot more features that are great if you need them. But for just calling endpoints, passing payloads, and checking responses this works.
@swildermuth
@swildermuth 5 ай бұрын
It's just text files that look like requests. That's why I like it. It doesn't help you as much, but also doesn't paywall anything. I like that it is simpler (and works in VS and VSCode).
@peymannaji
@peymannaji 5 ай бұрын
What if I have a POST request and ID is generated in backend and I would like to use that in the GET request? I'm asking this question, because I all the tutorials, ID's are always hard coded.
@swildermuth
@swildermuth 5 ай бұрын
No real way to do that right now. There is a random parameter but I dont' find it useful.
@peymannaji
@peymannaji 5 ай бұрын
@@swildermuth Thanks 😊 🙏
@paddymcsquirrel
@paddymcsquirrel 5 ай бұрын
Say you want to generate token and use it subsequently, you can name the first request ( in VS Code, maybe also in VS 20*) as a comment before the request, eg ‘# name @login’, then refer to the response in subsequent requests using, e.g {{login.response.body.token}} (when response body is json), you can separate requests using ###
@paddymcsquirrel
@paddymcsquirrel 5 ай бұрын
So if the id is returned in the response to the first post, it should be possible to use it later
@paddymcsquirrel
@paddymcsquirrel 5 ай бұрын
Also, it may be ‘# @name login’
Coding Shorts: Use Open Telemetry in ASP.NET Core
15:32
Shawn Wildermuth
Рет қаралды 6 М.
Coding Shorts 108: Using TestContainers in .NET Core
17:27
Shawn Wildermuth
Рет қаралды 1,4 М.
Ozoda - Lada ( Official Music Video 2024 )
06:07
Ozoda
Рет қаралды 17 МЛН
БЕЛКА СЬЕЛА КОТЕНКА?#cat
00:13
Лайки Like
Рет қаралды 2,8 МЛН
Офицер, я всё объясню
01:00
История одного вокалиста
Рет қаралды 5 МЛН
Please Help This Poor Boy 🙏
00:40
Alan Chikin Chow
Рет қаралды 23 МЛН
Coding Shorts: C# Dialects and Idioms
19:13
Shawn Wildermuth
Рет қаралды 3,3 М.
Being Competent With Coding Is More Fun
11:13
TheVimeagen
Рет қаралды 85 М.
Rust Tutorial - Structs
16:09
CodingCampfire
Рет қаралды 28
Coding Shorts: Running Async Jobs in ASP.NET Core
9:52
Shawn Wildermuth
Рет қаралды 4,3 М.
Coding Shorts #102: Using SQL Server Containers for Dev
11:00
Shawn Wildermuth
Рет қаралды 2,9 М.
Coding Shorts #103: Using Code Cleanup in Visual Studio
12:30
Shawn Wildermuth
Рет қаралды 3,1 М.
The Value of Source Code
17:46
Philomatics
Рет қаралды 41 М.
Coding Shorts: Making Sense of Stack vs. Heap
5:33
Shawn Wildermuth
Рет қаралды 1,8 М.
These Coding Projects Give You An Unfair Advantage
14:39
Harkirat Singh
Рет қаралды 354 М.
Ozoda - Lada ( Official Music Video 2024 )
06:07
Ozoda
Рет қаралды 17 МЛН