restful全部命令

My that's a lot of acronyms. REPL means "Read Evaluate Print Loop." You know how you can run "python" and then just type 2+2 and get answer? That's a type of REPL.

我的缩写很多。 REPL的意思是“读取评估打印循环”。 您知道如何运行“ python”,然后键入2 + 2并获得答案吗? 那是REPL的一种。

The ASP.NET Core team is building a REPL that lets you explore and interact with your RESTful services. Ideally your services will have Swagger/OpenAPI available that describes the service. Right now this Http-REPL is just being developed and they're aiming to release it as a .NET Core Global Tool in .NET Core 2.2.

ASP.NET Core团队正在构建REPL,使您可以探索RESTful服务并与之交互。 理想情况下,您的服务应具有描述该服务的Swagger / OpenAPI 。 目前,此Http-REPL刚刚被开发,他们的目标是将其作为.NET Core 2.2中的.NET Core全局工具发布。

You can install global tools like this:

您可以这样安装全局工具:

dotnet tool install -g nyancat

Then you can run "nyancat." Get a list of installed tools like this:

然后,您可以运行“ nyancat”。 获取以下已安装工具的列表:

C:\Users\scott> dotnet tool list -g
Package Id                 Version                   Commands
--------------------------------------------------------------------
altcover.global            3.5.560                   altcover
dotnet-depends             0.1.0                     dotnet-depends
dotnet-httprepl            2.2.0-preview3-35304      dotnet-httprepl
dotnet-outdated            2.0.0                     dotnet-outdated
dotnet-search              1.0.0                     dotnet-search
dotnet-serve               1.0.0                     dotnet-serve
git-status-cli             1.0.0                     git-status
github-issues-cli          1.0.0                     ghi
nukeeper                   0.7.2                     NuKeeper
nyancat                    1.0.0                     nyancat
project2015to2017.cli      1.8.1                     csproj-to-2017

For the HTTP-REPL, since it's not yet released you have to point the Tool Feed to a daily build location, so do this:

对于HTTP-REPL,由于尚未发布,因此您必须将工具Feed指向每日构建位置,因此请执行以下操作:

dotnet tool install -g --version 2.2.0-* --add-source https://dotnet.myget.org/F/dotnet-core/api/v3/index.json dotnet-httprepl

Then run it with "dotnet httprepl." I'd like another name? What do you think? RESTy? POSTr? API Test? API View?

然后使用“ dotnet httprepl”运行它。 我想要别的名字吗? 你怎么看? 休息吗海报? API测试? API视图?

Here's an example run where I start up a Web API.

这是我启动Web API的示例运行。

C:\SwaggerApp> dotnet httprepl
(Disconnected)~ set base http://localhost:65369
Using swagger metadata from http://localhost:65369/swagger/v1/swagger.jsonhttp://localhost:65369/~ dir
.        []
People   [get|post]
Values   [get|post]http://localhost:65369/~ cd People
/People    [get|post]http://localhost:65369/People~ dir
.      [get|post]
..     []
{id}   [get]http://localhost:65369/People~ get
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Wed, 26 Sep 2018 20:25:37 GMT
Server: Kestrel
Transfer-Encoding: chunked[{"id": 1,"name": "Scott Hunter"},{"id": 0,"name": "Scott Hanselman"},{"id": 2,"name": "Scott Guthrie"}
]

Take a moment and read that. It can be a little confusing. It's not HTTPie, it's not Curl, but it's also not PostMan. it's something that you run and stay running if you're a command line person and enjoy that space. It's as if you "cd (change directory)" and "mount" a disk into your Web API.

花一点时间阅读。 可能会有些混乱。 它不是HTTPie ,不是Curl,但是它也不是PostMan。 如果您是命令行用户并且喜欢这个空间,那么您可以运行并保持运行。 就像您将cd(更改目录)并将磁盘“装入” Web API一样。

You can use all the HTTP Verbs, and when POSTing you can set a default text editor and it will launch the editor with the JSON written for you! Give it a try!

您可以使用所有HTTP动词,并且在POST时可以设置默认的文本编辑器,它将使用为您编写的JSON启动编辑器! 试一试!

A few gotchas/known issues:

一些陷阱/已知问题:

  • You'll want to set a default Content-Type Header for your session. I think this should be default.您需要为会话设置默认的Content-Type标头。 我认为这应该是默认设置。
    • set header Content-Type application/json

      设置标头Content-Type application / json

  • If the HTTP REPL doesn't automatically detect your Swagger/OpenAPI endpoint, you'll need to set it manually:如果HTTP REPL无法自动检测到您的Swagger / OpenAPI端点,则需要手动进行设置:
    • set base https://yourapi/api/v1/

      设置基础https:// yourapi / api / v1 /

    • set swagger https://yourapi/swagger.json

      设置摇摇欲坠https://yourapi/swagger.json

  • I haven't figure out how to get it to use VS Code as its default editor. Likely because "code.exe" isn't a thing. (It uses a batch .cmd file, which the HTTP REPL would need to special case). For now, use an editor that's an EXE and point the HTTP REPL like this:我还没有弄清楚如何使用VS Code作为其默认编辑器。 可能是因为“ code.exe”不是问题。 (它使用一个批处理.cmd文件,HTTP REPL在特殊情况下需要使用该文件)。 现在,使用作为EXE的编辑器,并指向HTTP REPL,如下所示:
    • pref set editor.command.default 'c:\notepad2.exe'

      预设置editor.command.default'c:\ notepad2.exe'

I'm really enjoy this idea. I'm curious how you find it and how you'd see it being used. Sound off in the comments.

我真的很喜欢这个主意。 我很好奇您如何找到它以及如何使用它。 在评论中听起来不错。

翻译自: https://www.hanselman.com/blog/a-commandline-repl-for-restful-http-services

restful全部命令

restful全部命令_RESTful HTTP服务的命令行REPL相关推荐

  1. dubbo的invoke命令_dubbo 调试服务telnet命令

    1.概述 在我们使用dubbo实现分布式布局时,如果我们想测试我们刚写好的service层服务是否正确时,通常要将service层和web层同时开启,通过浏览器调用controller层端口,达到测试 ...

  2. exportfs命令和FTP服务

    一.exportfs 命令 1.常用选项命令: -a :表示全部挂载或者卸载 -r:表示重新挂载 -u:表示卸载某一个目录 -v:表示显示共享目录 2.编辑/etc//exports:增加以下内容 / ...

  3. SC-控制Windows服务的命令

    Windows自带一个控制服务的命令-SC,下面用Terminal Service做个简单例子: 查询Terminal Service的配置 C:\Users\jackie.chen>sc qc ...

  4. linux 查询注册服务,window下注册服务的命令小结

    1. 描述:     SC 是用于与服务控制管理器通信的命令行程序 . 用法: sc [command] [service name] ... 选项 的格式为 可以键入 "sc [comma ...

  5. 服务端命令(dockerd)

    服务端命令(dockerd) dockerd 命令选项 --api-cors-header="":CORS 头部域,默认不允许 CORS,要允许任意的跨域访问,可以指定为 &quo ...

  6. 红帽7 su命令与sudo服务

    1.su命令 su命令可以解决切换用户身份的需求,使得当前用户在不退出登录的情况下,顺畅地切换到其他用户,比如从root管理员切换至普通用户 [root@localhost Desktop]# su ...

  7. srs 服务关闭命令_【经验总结】如何做到网络版工作站与服务器时间同步?

    随着行业发展,越来越多的实验室色谱数据工作站由原来的单机版,升级为网络版.升级后带来的益不必多说,那么升级带来的困难你遇到过吗?快来跟小析姐一起看看牛人是如何解决问题的吧. 最近公司将色谱工作站进行了 ...

  8. centos 重启网卡_CentOS7网络配置和修改网卡名称及常用服务管理命令

    1.设置IP地址和网关及DNS CentOS7里面的网卡名称不在是eth0,1,2而改成enoxxxxxx的格式,en代表的是enthernet以太网,o代表onboard内置,这种新的方式不但长,而 ...

  9. winsw将命令部署为服务(比如springboot)

    工具 https://github.com/winsw/winsw/releases 下载.netcore的exe就行,比如 https://github.com/winsw/winsw/releas ...

最新文章

  1. 【转】iOS-Core-Animation-Advanced-Techniques(六)
  2. 《大话数据结构》读书笔记-串
  3. 小议看板列与职能筒仓
  4. SQL Server查询所有数据库下模式schema
  5. 【数字信号处理】分贝的概念及其日常使用中常见的错误
  6. 【转】第01课:生活中的监听模式——一坑爹的热水器
  7. linux python 图形界面开发_python在linux制作图形界面(snack)
  8. 数据结构中三表合一的实现
  9. How do I create 2D water with dynamic waves?
  10. python+pyqt5实现24点小游戏
  11. Java游戏程序设计教程 4.5打砖块游戏
  12. Win8仿Win10无边框效果的实现
  13. 倾斜摄影计算机配置,2019年倾斜摄影三维建模-台式、便携、多机集群配置推荐...
  14. 阶乘 java_Java 实例 – 阶乘
  15. iqos烟弹哪个最好抽?我品尝了十一种电子烟烟弹后告诉你
  16. Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx)
  17. kubernetes(centos7)域名解析失败
  18. 查询python答案的app_2020知到APP大数据分析的python基础最新免费答案查询
  19. wxpython表格怎么分页_Word表格跨页断行如何排版?Word表格换页脱节怎么办?
  20. windows tcpdump

热门文章

  1. 更新系统后小米note显示无服务器,小米解答MIUI 9系统升级常见问题
  2. 使用Office 365账号配置SMTP中继服务器
  3. Linux之curl请求
  4. GF1-WFV批量正射校正和批量大气校正
  5. 样本方差的简化计算公式
  6. 【基础建模】实例一:碰碰球和茶几、沙发
  7. 玩吃鸡台式计算机配置,2020吃鸡台式电脑配置清单 最佳配置搭配这样来
  8. 机器学习基础01-线性代数
  9. Java课堂作业 Day2
  10. Reac学习记录(一) - 函数式组件与类组件