-
Notifications
You must be signed in to change notification settings - Fork 0
/
00003-README.patch
364 lines (364 loc) · 10.2 KB
/
00003-README.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
diff --git a/README.md b/README.md
index b40a5ab..acc9691 100644
--- a/README.md
+++ b/README.md
@@ -1,358 +1 @@
-# Inspiration
-
-With the rise in usage of microservices, Making http requests is essential job of most devs. For these, there are multiple options like curl, insomnia postman. My Ideal choice is to use curl but problems with it is, having no history and no easy way to save and rerun. Postman solves that problem, but once user logs in(earlier it used to be optional, now its mandatory), it stores all request metadata(body/headers/urls/credentails) to their servers although it helps solve using it across multiple devices, backup but it could be potential security loop hole if they can access it. (now a days, postman desktop is super slow also).
-
-This project aims to solve save&reuse requests, maintaining history and no sync in proprietery servers (although you can achive sync via commiting http files into git).
-
-## GOAL
-
-dothttp will provide simple, cleaner architecture for making http requests. It uses xtext (eclipse developed dsl) to build a custom dsl.
-
-
-### Documentation
-
-More information or docs can be cound at https://docs.dothttp.dev
-
-
----
-Go through this example for better understanding. for babysteps click [here](#first-dothttprequest-and-more)
-```http
-# users.http
-
-#!/usr/bin/env /home/prasanth/cedric05/dothttp/dist/dothttp-cli
-
-# this is comment
-
-// this is also a comment
-
-/*
- this is multi line
- comment
-*/
-
-# http file can have multiple requests, name tag/annotation is used to identify
-@name("fetch 100 users, skip first 50")
-
-# makes are get request, with url `https://req.dothttp.dev/user`
-GET https://req.dothttp.dev/user
-
-# below is an header example
-"Authorization": "Basic dXNlcm5hbWU6cGFzc3dvcmQ="
-
-# below is how you set url params '?' --> signifies url quary param
-? ("fetch", "100") #
-? ("skip", "50")
-? projection, name
-? projection, org
-? projection, location
-
-
-
-
-# makes are post request, with url `https://req.dothttp.dev/user`
-POST https://req.dothttp.dev/user
-
-basicauth('username', 'password')
-/*
- below defines payload for the post request.
- json --> signifies payload is json data
-*/
-json({
- "name": "{{name=adam}}", # name is templated, if spcified via env or property, it will be replaced
- "org": "dothttp",
- "location": "Hyderabad",
- # "interests": ["exploring", "listening to music"],
-})
-
-
-
-# makes put request, with url `https://req.dothttp.dev/user/1`
-PUT https://req.dothttp.dev/post
-
-# define headers in .dothttp.json with env
-basicauth("{{username}}, "{{password}}")
-
-# posts with urlencoded
-data({
- "name": "Adam A",
- "org": "dothttp",
- "location": "Hyderabad",
- "interests": ["exploring", "listening to music"],
-})
-
-// or use below one
-// data('name=Adam+A&org=dothttp&location=Hyderabad&interests=%5B%27exploring%27%2C+%27listening+to+music%27%5D')
-```
-
-## KICKSTART
-
-### From pypi
-
-```shell
-pip install dothttp-req==0.0.10
-```
-
-### From source
-
-```shell
-git clone [email protected]:cedric05/dothttp.git
-cd dothttp
-
-python3 -m pip install pipenv
-pipenv install
-```
-
-### python3.9
-
-```shell
-python3 -m dothttp examples/dothttpazure.http
-```
-
-### docker
-
-```shell
-docker build -t dothttp .
-docker run -it --rm dothttp
-```
-
-### whalebrew
-
-```shell
-docker run -it --rm dothttp
-```
-
-## Features
-
-1. easy and cleaner http syntax
-1. variable substitution with property file
-1. generates curl from http for easy sharing
-
-```shell
-docker build -t dothttp .
-whalebrew install dothttp
-dothttp examples/dothttpazure.http
-```
-
-## First DotHttpRequest and more
-
-```get.http
-GET "http://localhost:8000/get"
-```
-
-`dothttp get.http` or `python -m dothttp get.http`
-
-## Run
-
-`dothttp simple.http`
-
-prints
-
-```json
-{
- "args": {},
- "headers": {
- "Accept-Encoding": "identity",
- "Host": "httpbin.org",
- "User-Agent": "python-urllib3/1.26.3",
- "X-Amzn-Trace-Id": "Root=1-6022266a-20fb552e530ba3d90c75be6d"
- },
- "origin": "117.216.243.24",
- "url": "http://localhost:8000/get"
-}
-```
-
-### POST request
-
-```post.http
-POST "http://localhost:8000/post"
-```
-
-```json
-{
- "args": {},
- "data": "",
- "files": {},
- "form": {},
- "headers": {
- "Accept-Encoding": "identity",
- "Content-Length": "0",
- "Host": "httpbin.org",
- "User-Agent": "python-urllib3/1.26.3",
- "X-Amzn-Trace-Id": "Root=1-602228fa-3c3ed5213b6d8c2d2a223148"
- },
- "json": null,
- "origin": "117.216.243.24",
- "url": "http://localhost:8000/post"
-}
-```
-
-similarly, other methods`GET, POST, OPTIONS, DELETE, CONNECT, PUT, HEAD, TRACE` support is available.
-
-### Query
-
-query params can be added to request by specifying
-` query ( "key", "value")`
-` ? "key", "value"`
-` ? "key": "value"`
-` ? "key"= "value"`
-all four are accepted. going with `query("hi", "hi2)` is more readable. `?"key"= "value"` is more concise
-
-### Payload
-
-user can specify payload by mentioning below four forms (for various scenarios).
-
-- `data("ram")`
-
- user can also mention its `content-type` with
- `data("ram", "text/plain")`
-- `data({"key": "value"})` for form input.
-- `json({"key": "value"})` for json payload.
-- `fileinput("path/to/file", "type")` uploads file as payload (type is optional).
-- `files(("photo", "path/to/file/photo.jpg", "image/jpeg"),
- ("photo details", '{"name":"prasanth"}', "application/json")
- )`
-
- for multipart upload
- **dothttp** will figure out content type by going through file/data, when type is not mentioned.
-
-### Comments
-
-**dothttp** will use `#` for commenting entire line.
-
-1. `//` line comment. follows java, javascript
-2. `#` line comment. follows python's comment style
-3. `/*
- */` multi line comment. follows java/javascript style
-
-### Templating
-
-```.http
-POST 'http://localhost:8000/post'
-? ("{{key}}", "{{value}}")
-data('{"{{key}}" :"{{value}}"}', 'application/json')
-```
-
-- specify variable values through property file ([sample.json](./examples/.dothttp.json)).
- - user can define environments and can activate multiple environments at a time
- - **dothttp** by default will read variables from `"*"` section
- - for example
- `dothttp --property-file path/to/file.json --env ram chandra`
-
- will activate `*` section properties, `ram` section properties and `chandra` section properties
- `dothttp --env ram chandra`
- will activate `*` section properties, `ram` section properties and `chandra` section properties
- from `.dothttp.json` in httpfile name space
-- through command line
- `dothttp --property key=ram value=ranga`
- will replace `{{ram}}` to `ranga` from the file
-- through file itself. (will be helpful for default properties)
-
-```
-POST 'https://{{host=httpbin.org}}/post'
-```
-
-### Headers
-
-User can define headers in below three formats
-
-1. `header('content-type', 'application/json')` readable
-2. `'content-type': 'application/json'` concise
-3. property file `headers` section from property-file can also be used. in most scenarios, headers section will be
- common for a host. having them in property file would ease them.
-
-### Authentication
-
-#### BasicAuth
-`basicauth('username','password')'` --> will compute add respective headers.
-
-#### DigestAuth
-`digestauth('username','password')'` --> will compute add respective headers.
-
-#### NtlmAuth
-`ntlmauth('username','password')'` --> will compute add respective headers.
-
-### Property file
-
-```json
-{
- "*": {
- "host": "httpbin.org"
- },
- "headers": {
- "content-type": "plain/text"
- },
- "preprod": {
- "host": "preprod.httpbin.org"
- }
-}
-```
-
-#### Special sections in property file
-
-1. `*` section in property file will be activated once user specifies property file if user didn't specifiy file
- and `.dothttp.json` exists, it will be activated
-2. `headers` once a property file is activated. headers from property file will be added to request by default without
- user having to specify in `.http` file
-
-#### Formatter (experimental phase)
-
-**dothttp** can format a http file using below command
-`dothttp -fmt examples/dothttpazure.http --experimental`
-or
-`dothttp --format examples/dothttpazure.http --experimental`
-
-to print to command line
-
-`dothttp --format examples/dothttpazure.http --experimental --stdout`
-
-### Editor support
-
-syntax highlighting for visual studio code is supported
-via [dothttp-code](https://marketplace.visualstudio.com/items?itemName=ShivaPrasanth.dothttp-code)
-
-### Command line options
-
-```
-usage: dothttp [-h] [--curl] [--property-file PROPERTY_FILE] [--no-cookie] [--env ENV [ENV ...]] [--debug] [--info] [--format] [--stdout]
- [--property PROPERTY [PROPERTY ...]]
- file
-
-http requests for humans
-
-optional arguments:
- -h, --help show this help message and exit
-
-general:
- --curl generates curl script
- --no-cookie, -nc cookie storage is disabled
- --debug, -d debug will enable logs and exceptions
- --info, -i more information
- file http file
-
-property:
- --property-file PROPERTY_FILE, -p PROPERTY_FILE
- property file
- --env ENV [ENV ...], -e ENV [ENV ...]
- environment to select in property file. properties will be enabled on FIFO
- --property PROPERTY [PROPERTY ...]
- list of property's
-
-format:
- --format, -fmt formatter
- --stdout print to commandline
-```
-
-checkout [examples]('./examples/dothttpazure.http')
-
------------
-### Vscode alternatives
-
-- [rest-client](https://marketplace.visualstudio.com/items?itemName=humao.rest-client) written in typescript
-- [httpYac](https://marketplace.visualstudio.com/items?itemName=anweber.vscode-httpyac) written in typescript
-- [Thunder Client](https://marketplace.visualstudio.com/items?itemName=rangav.vscode-thunder-client) closed source
-
----------
-### Non Vscode alternatives
-- [http-client](https://www.jetbrains.com/help/idea/http-client-in-product-code-editor.html) closed source
-- [dothttp](https://github.com/tonsV2/dothttp) written in python
-
+Please refer [dothttp](https://github.com/cedric05/dothttp-wasm) for more information.