├── CODE_OF_CONDUCT.md ├── LICENSE.TXT ├── README.md └── spec.md /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | This code of conduct outlines our expectations for all those who participate in our open source projects and communities (community programs), as well as the consequences for unacceptable behaviour. We invite all those who participate to help us create safe and positive experiences for everyone. Communities mirror the societies in which they exist and positive action is essential to counteract the many forms of inequality and abuses of power that exist in society. 4 | 5 | ## How to behave 6 | 7 | The following behaviours are expected and requested of all community members: 8 | 9 | - Participate in an authentic and active way. In doing so, you contribute to the health and longevity of this community. 10 | - Exercise consideration, respect and empathy in your speech and actions. Remember, we have all been through different stages of learning when adopting technologies. 11 | - Refrain from demeaning, discriminatory, or harassing behaviour and speech. 12 | - Disagreements on things are fine, argumentative behaviour or trolling are not. 13 | 14 | ## How not to behave 15 | 16 | - Do not perform threats of violence or use violent language directed against another person. 17 | - Do not make jokes of sexist, racist, homophobic, transphobic, ableist or otherwise discriminatory nature, or use language of this nature. 18 | - Do not post or display sexually explicit or violent material. 19 | - Do not post or threaten to post other people's personally identifying information ("doxing"). 20 | - Do not make personal insults, particularly those related to gender, sexual orientation, race, religion, or disability. 21 | - Do not engage in sexual attention. This includes, sexualised comments or jokes and sexual advances. 22 | - Do not advocate for, or encourage, any of the above behaviour. 23 | 24 | Please take into account that online communities bring together people from many different cultures and backgrounds. It's important to understand that sometimes the combination of cultural differences and online interaction can lead to misunderstandings. That is why having empathy is very important. 25 | 26 | ## How to report issues 27 | 28 | If someone is acting inappropriately or violating this Code of Conduct in any shape or form, and they are not receptive to your feedback or you prefer not to confront them, please reach out to JetBrains via  29 | 30 | ## Consequences of Unacceptable Behaviour 31 | 32 | Unacceptable behaviour from any community member will not be tolerated. Anyone asked to stop unacceptable behaviour is expected to comply immediately. If a community member engages in unacceptable behaviour, JetBrains and/or community organisers may take any action they deem appropriate, up to and including a temporary ban or permanent expulsion from the community without warning. 33 | 34 | ## License and attribution 35 | 36 | The license is based off of The Citizen Code of Conduct is distributed by Stumptown Syndicate under a Creative Commons Attribution-ShareAlike license. 37 | -------------------------------------------------------------------------------- /LICENSE.TXT: -------------------------------------------------------------------------------- 1 | Attribution 4.0 International 2 | 3 | ======================================================================= 4 | 5 | Creative Commons Corporation ("Creative Commons") is not a law firm and 6 | does not provide legal services or legal advice. Distribution of 7 | Creative Commons public licenses does not create a lawyer-client or 8 | other relationship. Creative Commons makes its licenses and related 9 | information available on an "as-is" basis. Creative Commons gives no 10 | warranties regarding its licenses, any material licensed under their 11 | terms and conditions, or any related information. Creative Commons 12 | disclaims all liability for damages resulting from their use to the 13 | fullest extent possible. 14 | 15 | Using Creative Commons Public Licenses 16 | 17 | Creative Commons public licenses provide a standard set of terms and 18 | conditions that creators and other rights holders may use to share 19 | original works of authorship and other material subject to copyright 20 | and certain other rights specified in the public license below. The 21 | following considerations are for informational purposes only, are not 22 | exhaustive, and do not form part of our licenses. 23 | 24 | Considerations for licensors: Our public licenses are 25 | intended for use by those authorized to give the public 26 | permission to use material in ways otherwise restricted by 27 | copyright and certain other rights. Our licenses are 28 | irrevocable. Licensors should read and understand the terms 29 | and conditions of the license they choose before applying it. 30 | Licensors should also secure all rights necessary before 31 | applying our licenses so that the public can reuse the 32 | material as expected. Licensors should clearly mark any 33 | material not subject to the license. This includes other CC- 34 | licensed material, or material used under an exception or 35 | limitation to copyright. More considerations for licensors: 36 | wiki.creativecommons.org/Considerations_for_licensors 37 | 38 | Considerations for the public: By using one of our public 39 | licenses, a licensor grants the public permission to use the 40 | licensed material under specified terms and conditions. If 41 | the licensor's permission is not necessary for any reason--for 42 | example, because of any applicable exception or limitation to 43 | copyright--then that use is not regulated by the license. Our 44 | licenses grant only permissions under copyright and certain 45 | other rights that a licensor has authority to grant. Use of 46 | the licensed material may still be restricted for other 47 | reasons, including because others have copyright or other 48 | rights in the material. A licensor may make special requests, 49 | such as asking that all changes be marked or described. 50 | Although not required by our licenses, you are encouraged to 51 | respect those requests where reasonable. More considerations 52 | for the public: 53 | wiki.creativecommons.org/Considerations_for_licensees 54 | 55 | ======================================================================= 56 | 57 | Creative Commons Attribution 4.0 International Public License 58 | 59 | By exercising the Licensed Rights (defined below), You accept and agree 60 | to be bound by the terms and conditions of this Creative Commons 61 | Attribution 4.0 International Public License ("Public License"). To the 62 | extent this Public License may be interpreted as a contract, You are 63 | granted the Licensed Rights in consideration of Your acceptance of 64 | these terms and conditions, and the Licensor grants You such rights in 65 | consideration of benefits the Licensor receives from making the 66 | Licensed Material available under these terms and conditions. 67 | 68 | 69 | Section 1 -- Definitions. 70 | 71 | a. Adapted Material means material subject to Copyright and Similar 72 | Rights that is derived from or based upon the Licensed Material 73 | and in which the Licensed Material is translated, altered, 74 | arranged, transformed, or otherwise modified in a manner requiring 75 | permission under the Copyright and Similar Rights held by the 76 | Licensor. For purposes of this Public License, where the Licensed 77 | Material is a musical work, performance, or sound recording, 78 | Adapted Material is always produced where the Licensed Material is 79 | synched in timed relation with a moving image. 80 | 81 | b. Adapter's License means the license You apply to Your Copyright 82 | and Similar Rights in Your contributions to Adapted Material in 83 | accordance with the terms and conditions of this Public License. 84 | 85 | c. Copyright and Similar Rights means copyright and/or similar rights 86 | closely related to copyright including, without limitation, 87 | performance, broadcast, sound recording, and Sui Generis Database 88 | Rights, without regard to how the rights are labeled or 89 | categorized. For purposes of this Public License, the rights 90 | specified in Section 2(b)(1)-(2) are not Copyright and Similar 91 | Rights. 92 | 93 | d. Effective Technological Measures means those measures that, in the 94 | absence of proper authority, may not be circumvented under laws 95 | fulfilling obligations under Article 11 of the WIPO Copyright 96 | Treaty adopted on December 20, 1996, and/or similar international 97 | agreements. 98 | 99 | e. Exceptions and Limitations means fair use, fair dealing, and/or 100 | any other exception or limitation to Copyright and Similar Rights 101 | that applies to Your use of the Licensed Material. 102 | 103 | f. Licensed Material means the artistic or literary work, database, 104 | or other material to which the Licensor applied this Public 105 | License. 106 | 107 | g. Licensed Rights means the rights granted to You subject to the 108 | terms and conditions of this Public License, which are limited to 109 | all Copyright and Similar Rights that apply to Your use of the 110 | Licensed Material and that the Licensor has authority to license. 111 | 112 | h. Licensor means the individual(s) or entity(ies) granting rights 113 | under this Public License. 114 | 115 | i. Share means to provide material to the public by any means or 116 | process that requires permission under the Licensed Rights, such 117 | as reproduction, public display, public performance, distribution, 118 | dissemination, communication, or importation, and to make material 119 | available to the public including in ways that members of the 120 | public may access the material from a place and at a time 121 | individually chosen by them. 122 | 123 | j. Sui Generis Database Rights means rights other than copyright 124 | resulting from Directive 96/9/EC of the European Parliament and of 125 | the Council of 11 March 1996 on the legal protection of databases, 126 | as amended and/or succeeded, as well as other essentially 127 | equivalent rights anywhere in the world. 128 | 129 | k. You means the individual or entity exercising the Licensed Rights 130 | under this Public License. Your has a corresponding meaning. 131 | 132 | 133 | Section 2 -- Scope. 134 | 135 | a. License grant. 136 | 137 | 1. Subject to the terms and conditions of this Public License, 138 | the Licensor hereby grants You a worldwide, royalty-free, 139 | non-sublicensable, non-exclusive, irrevocable license to 140 | exercise the Licensed Rights in the Licensed Material to: 141 | 142 | a. reproduce and Share the Licensed Material, in whole or 143 | in part; and 144 | 145 | b. produce, reproduce, and Share Adapted Material. 146 | 147 | 2. Exceptions and Limitations. For the avoidance of doubt, where 148 | Exceptions and Limitations apply to Your use, this Public 149 | License does not apply, and You do not need to comply with 150 | its terms and conditions. 151 | 152 | 3. Term. The term of this Public License is specified in Section 153 | 6(a). 154 | 155 | 4. Media and formats; technical modifications allowed. The 156 | Licensor authorizes You to exercise the Licensed Rights in 157 | all media and formats whether now known or hereafter created, 158 | and to make technical modifications necessary to do so. The 159 | Licensor waives and/or agrees not to assert any right or 160 | authority to forbid You from making technical modifications 161 | necessary to exercise the Licensed Rights, including 162 | technical modifications necessary to circumvent Effective 163 | Technological Measures. For purposes of this Public License, 164 | simply making modifications authorized by this Section 2(a) 165 | (4) never produces Adapted Material. 166 | 167 | 5. Downstream recipients. 168 | 169 | a. Offer from the Licensor -- Licensed Material. Every 170 | recipient of the Licensed Material automatically 171 | receives an offer from the Licensor to exercise the 172 | Licensed Rights under the terms and conditions of this 173 | Public License. 174 | 175 | b. No downstream restrictions. You may not offer or impose 176 | any additional or different terms or conditions on, or 177 | apply any Effective Technological Measures to, the 178 | Licensed Material if doing so restricts exercise of the 179 | Licensed Rights by any recipient of the Licensed 180 | Material. 181 | 182 | 6. No endorsement. Nothing in this Public License constitutes or 183 | may be construed as permission to assert or imply that You 184 | are, or that Your use of the Licensed Material is, connected 185 | with, or sponsored, endorsed, or granted official status by, 186 | the Licensor or others designated to receive attribution as 187 | provided in Section 3(a)(1)(A)(i). 188 | 189 | b. Other rights. 190 | 191 | 1. Moral rights, such as the right of integrity, are not 192 | licensed under this Public License, nor are publicity, 193 | privacy, and/or other similar personality rights; however, to 194 | the extent possible, the Licensor waives and/or agrees not to 195 | assert any such rights held by the Licensor to the limited 196 | extent necessary to allow You to exercise the Licensed 197 | Rights, but not otherwise. 198 | 199 | 2. Patent and trademark rights are not licensed under this 200 | Public License. 201 | 202 | 3. To the extent possible, the Licensor waives any right to 203 | collect royalties from You for the exercise of the Licensed 204 | Rights, whether directly or through a collecting society 205 | under any voluntary or waivable statutory or compulsory 206 | licensing scheme. In all other cases the Licensor expressly 207 | reserves any right to collect such royalties. 208 | 209 | 210 | Section 3 -- License Conditions. 211 | 212 | Your exercise of the Licensed Rights is expressly made subject to the 213 | following conditions. 214 | 215 | a. Attribution. 216 | 217 | 1. If You Share the Licensed Material (including in modified 218 | form), You must: 219 | 220 | a. retain the following if it is supplied by the Licensor 221 | with the Licensed Material: 222 | 223 | i. identification of the creator(s) of the Licensed 224 | Material and any others designated to receive 225 | attribution, in any reasonable manner requested by 226 | the Licensor (including by pseudonym if 227 | designated); 228 | 229 | ii. a copyright notice; 230 | 231 | iii. a notice that refers to this Public License; 232 | 233 | iv. a notice that refers to the disclaimer of 234 | warranties; 235 | 236 | v. a URI or hyperlink to the Licensed Material to the 237 | extent reasonably practicable; 238 | 239 | b. indicate if You modified the Licensed Material and 240 | retain an indication of any previous modifications; and 241 | 242 | c. indicate the Licensed Material is licensed under this 243 | Public License, and include the text of, or the URI or 244 | hyperlink to, this Public License. 245 | 246 | 2. You may satisfy the conditions in Section 3(a)(1) in any 247 | reasonable manner based on the medium, means, and context in 248 | which You Share the Licensed Material. For example, it may be 249 | reasonable to satisfy the conditions by providing a URI or 250 | hyperlink to a resource that includes the required 251 | information. 252 | 253 | 3. If requested by the Licensor, You must remove any of the 254 | information required by Section 3(a)(1)(A) to the extent 255 | reasonably practicable. 256 | 257 | 4. If You Share Adapted Material You produce, the Adapter's 258 | License You apply must not prevent recipients of the Adapted 259 | Material from complying with this Public License. 260 | 261 | 262 | Section 4 -- Sui Generis Database Rights. 263 | 264 | Where the Licensed Rights include Sui Generis Database Rights that 265 | apply to Your use of the Licensed Material: 266 | 267 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right 268 | to extract, reuse, reproduce, and Share all or a substantial 269 | portion of the contents of the database; 270 | 271 | b. if You include all or a substantial portion of the database 272 | contents in a database in which You have Sui Generis Database 273 | Rights, then the database in which You have Sui Generis Database 274 | Rights (but not its individual contents) is Adapted Material; and 275 | 276 | c. You must comply with the conditions in Section 3(a) if You Share 277 | all or a substantial portion of the contents of the database. 278 | 279 | For the avoidance of doubt, this Section 4 supplements and does not 280 | replace Your obligations under this Public License where the Licensed 281 | Rights include other Copyright and Similar Rights. 282 | 283 | 284 | Section 5 -- Disclaimer of Warranties and Limitation of Liability. 285 | 286 | a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE 287 | EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS 288 | AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF 289 | ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, 290 | IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, 291 | WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR 292 | PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, 293 | ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT 294 | KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT 295 | ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. 296 | 297 | b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE 298 | TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, 299 | NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, 300 | INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, 301 | COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR 302 | USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN 303 | ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR 304 | DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR 305 | IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. 306 | 307 | c. The disclaimer of warranties and limitation of liability provided 308 | above shall be interpreted in a manner that, to the extent 309 | possible, most closely approximates an absolute disclaimer and 310 | waiver of all liability. 311 | 312 | 313 | Section 6 -- Term and Termination. 314 | 315 | a. This Public License applies for the term of the Copyright and 316 | Similar Rights licensed here. However, if You fail to comply with 317 | this Public License, then Your rights under this Public License 318 | terminate automatically. 319 | 320 | b. Where Your right to use the Licensed Material has terminated under 321 | Section 6(a), it reinstates: 322 | 323 | 1. automatically as of the date the violation is cured, provided 324 | it is cured within 30 days of Your discovery of the 325 | violation; or 326 | 327 | 2. upon express reinstatement by the Licensor. 328 | 329 | For the avoidance of doubt, this Section 6(b) does not affect any 330 | right the Licensor may have to seek remedies for Your violations 331 | of this Public License. 332 | 333 | c. For the avoidance of doubt, the Licensor may also offer the 334 | Licensed Material under separate terms or conditions or stop 335 | distributing the Licensed Material at any time; however, doing so 336 | will not terminate this Public License. 337 | 338 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public 339 | License. 340 | 341 | 342 | Section 7 -- Other Terms and Conditions. 343 | 344 | a. The Licensor shall not be bound by any additional or different 345 | terms or conditions communicated by You unless expressly agreed. 346 | 347 | b. Any arrangements, understandings, or agreements regarding the 348 | Licensed Material not stated herein are separate from and 349 | independent of the terms and conditions of this Public License. 350 | 351 | 352 | Section 8 -- Interpretation. 353 | 354 | a. For the avoidance of doubt, this Public License does not, and 355 | shall not be interpreted to, reduce, limit, restrict, or impose 356 | conditions on any use of the Licensed Material that could lawfully 357 | be made without permission under this Public License. 358 | 359 | b. To the extent possible, if any provision of this Public License is 360 | deemed unenforceable, it shall be automatically reformed to the 361 | minimum extent necessary to make it enforceable. If the provision 362 | cannot be reformed, it shall be severed from this Public License 363 | without affecting the enforceability of the remaining terms and 364 | conditions. 365 | 366 | c. No term or condition of this Public License will be waived and no 367 | failure to comply consented to unless expressly agreed to by the 368 | Licensor. 369 | 370 | d. Nothing in this Public License constitutes or may be interpreted 371 | as a limitation upon, or waiver of, any privileges and immunities 372 | that apply to the Licensor or You, including from the legal 373 | processes of any jurisdiction or authority. 374 | 375 | 376 | ======================================================================= 377 | 378 | Creative Commons is not a party to its public licenses. 379 | Notwithstanding, Creative Commons may elect to apply one of its public 380 | licenses to material it publishes and in those instances will be 381 | considered the “Licensor.” The text of the Creative Commons public 382 | licenses is dedicated to the public domain under the CC0 Public Domain 383 | Dedication. Except for the limited purpose of indicating that material 384 | is shared under a Creative Commons public license or as otherwise 385 | permitted by the Creative Commons policies published at 386 | creativecommons.org/policies, Creative Commons does not authorize the 387 | use of the trademark "Creative Commons" or any other trademark or logo 388 | of Creative Commons without its prior written consent including, 389 | without limitation, in connection with any unauthorized modifications 390 | to any of its public licenses or any other arrangements, 391 | understandings, or agreements concerning use of licensed material. For 392 | the avoidance of doubt, this paragraph does not form part of the public 393 | licenses. 394 | 395 | Creative Commons may be contacted at creativecommons.org. 396 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HTTP Request in Editor Specification [![official JetBrains project](http://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub) 2 | The document describes the HTTP Request in Editor format designed to provide a simple way to create, execute and store information about HTTP requests. The specification mostly repeats [RFC 7230](https://tools.ietf.org/html/rfc7230#section-3) with several extensions intended for easier requests composing and editing. 3 | 4 | ## Contribution 5 | To fix a typo or inconsistency, or to improve wording, please feel free to create a pull request to the repo. 6 | 7 | To propose format extension, please create an issue in the repo and describe the problem that the proposed change will solve. 8 | 9 | ## Licence 10 | Specification is distributed under [CC BY 4.0](LICENSE.TXT) 11 | -------------------------------------------------------------------------------- /spec.md: -------------------------------------------------------------------------------- 1 | # 1. Introduction 2 | ## 1.1. General 3 | The document describes the HTTP Request in Editor format designed to provide a simple way to create, execute, and store information about HTTP requests. The specification mostly repeats [RFC 7230](https://tools.ietf.org/html/rfc7230#section-3https://tools.ietf.org/html/rfc7230#section-3) with several extensions intended for easier requests composing and editing. 4 | 5 | The differences between [RFC 7230](https://tools.ietf.org/html/rfc7230#section-3https://tools.ietf.org/html/rfc7230#section-3) and the HTTP Request in Editor format are highlighted using a smaller font size, e.g.:
6 | This text highlights the differences between the base HTTP message protocol and the HTTP Request in Editor format. 7 | 8 | The document is intended to serve as a complete and self-consistent specification. All readers are invited to report any errors, typos and inconsistencies. 9 | ## 1.2. Example Request 10 | ``` 11 | ### 12 | POST http://example.com/api/add 13 | Content-Type: application/json 14 | 15 | { 16 | “name”: “entity”, 17 | “value”: “content” 18 | } 19 | ``` 20 | 21 | The above fragment will execute a POST request to http://example.com/api/add with the JSON message body. 22 | 23 | ## 1.3. Notation 24 | The format is described using context-free grammar and semantics written in natural language. Context-free grammar provides a formal definition, while format semantics explains the purpose and possible use cases for the statements. 25 | 26 | Context-free grammar is represented as a set of production rules. 27 | 28 | The base token can be replaced with the child token enclosed in parentheses. 29 | 30 | _base:_
31 |       _‘(’ child ‘)’_
32 | 33 | The base token can be replaced with either child-1 or child-2. 34 | 35 | _base:_
36 |       _child-1_
37 |       _child-2_
38 | 39 | The base token can be replaced with either child or optional-child followed by child. 40 | 41 | _base:_
42 |       _[optional-child] child_
43 | 44 | The base token can be replaced with child taken one or multiple times. 45 | 46 | _base:_
47 |       _(child)+_
48 | 49 | The base token can be replaced with either nothing or child taken one or multiple times. 50 | 51 | _base:_
52 |       _(child)*_
53 | 54 | # 2. Lexical structure 55 | ## 2.1. Base symbols 56 | _input-character:_
57 |       _any Unicode character except new-line_

58 | Unlike the HTTP message format described in [RFC 7230](https://tools.ietf.org/html/rfc7230#section-3), HTTP Request in Editor supports unicode characters as part of request target, path or query. 59 | 60 | _alpha:_
61 |       _ASCII Latin letters A-Z (\u0041- \u005a) or a-z (\u0061-\u007a)_
62 | 63 | _digit:_
64 |       _0-9 (\u0030-\u0039)_
65 | 66 | _identifier-character:_
67 |       _alpha_
68 |       _digit_
69 |       _‘-’_
70 |       _‘\_’_
71 | 72 | _identifier:_
73 |       _(ident_ifier-character)+_
74 | 75 | ## 2.2. Line Terminators 76 | _new-line:_
77 |       _LF, also known as "newline"_
78 |       _CR, also known as "return"_
79 |       _CR LF, “return” followed by “newline”_
80 | 81 | _new-line-with-indent:_
82 |       _new-line required-whitespace_
83 | 84 | _line-tail:_
85 |       _(input-character)* new-line_
86 | 87 | ## 2.3. Whitespaces 88 | _whitespace:_
89 |       _SP, also known as "space"_
90 |       _HT, also known as "horizontal tab"_
91 |       _FF, also known as "form feed"_
92 | 93 | _optional-whitespace:_
94 |       _(whitespace)*_
95 | 96 | _required-whitespace:_
97 |       _(whitespace)+_
98 | 99 | ## 2.4. Comments 100 | Line comments are supported in HTTP Requests. Comments can be used before or after a request, inside the header section, or within the request body. Comments used within the request body must start from the beginning of the line with or without indent. 101 | 102 | _line-comment:_
103 |       _‘#’ line-tail_
104 |       _‘//’ line-tail_
105 | 106 | __Example:__ 107 | ``` 108 | # request comment 109 | // request comment 110 | ``` 111 | 112 | The HTTP message protocol supports comments only as part of specialized header fields; HTTP Request in Editor supports general line comments. 113 | 114 | ## 2.5. Request Separators 115 | Multiple requests defined in a single file must be separated from each other with a request separator symbol. A separator may contain comments. 116 | 117 | _request-separator:_
118 |       _‘###’ line-tail_
119 | 120 | __Example:__ 121 | ``` 122 | ### 123 | ``` 124 | or 125 | ``` 126 | ### request comment 127 | ``` 128 | 129 | # 3. Grammar structure 130 | ## 3.1. Requests file 131 | An HTTP Requests file is a list of HTTP requests separated by a request separator. A file may start or end with multiple request separators. 132 | 133 | _requests-file:_
134 |       _(request-separator)* request (request-with-separator)* (request-separator)*_
135 | 136 | _request-with-separator:_
137 |       _(request-separator)+ request_
138 | 139 | __Example:__ 140 | ``` 141 | ### 142 | GET http://example.com 143 | ### 144 | GET http://example.com 145 | ### 146 | ``` 147 | One of the most important extensions HTTP Request in Editor provides is the support of multiple requests within a single file. This capability was introduced to make the format more flexible. 148 | 149 | ## 3.2. Request 150 | An HTTP request starts with a request line followed by optional header fields, message body, response handler, and previous response references. Message body must be separated from the request line or header fields with an empty line. 151 | 152 | _request:_
153 |       _request-line new-line headers new-line [message-body] [response-handler] [response-ref]_
154 | 155 | __Example:__ 156 | ``` 157 | POST http://example.com/auth 158 | Content-Type: application/json 159 | 160 | < input.json 161 | > {% client.global.set("auth", response.body.token); %} 162 | <> previous-response.200.json 163 | ``` 164 | Compared with the HTTP message format, two new request sections were introduced: response-ref and response-handler. 165 | ### 3.2.1 Request line 166 | A request line consists of a request method, target and the HTTP protocol version. If the request method is omitted, ‘GET’ will be used as a default. The HTTP protocol version can be also omitted. 167 | 168 | _request-line:_
169 |       _[method required-whitespace] request-target [required-whitespace http-version]_
170 | 171 | _method:_
172 |       _‘GET’_
173 |       _‘HEAD’_
174 |       _‘POST’_
175 |       _‘PUT’_
176 |       _‘DELETE’_
177 |       _‘CONNECT’_
178 |       _‘PATCH’_
179 |       _‘OPTIONS’_
180 |       _‘TRACE’_
181 | 182 | _http-version:_
183 |       _‘HTTP/’ (digit)+ ‘.’ (digit)+_
184 | 185 | __Example:__ 186 | ``` 187 | http://example.com 188 | ``` 189 | or 190 | ``` 191 | GET http://example.com HTTP/1.1 192 | ``` 193 | There are two important differences in request-line between the HTTP message and the HTTP Request in Editor formats:
194 |    1) The HTTP Request in Editor format pre-defines the list of supported methods; The HTTP message defines the method as any token;
195 |    2) The request method and the protocol version are optional in the HTTP Request in Editor format but are required in the HTTP message.
196 | #### 3.2.1.1 Request target 197 | A request target can be an absolute path on the server, a full path to the server resources including the request scheme, host, port, and the path on the server, and asterisk path, which is intended for performing server-wide requests. 198 | 199 | If the first request target type is used, the host must be defined in the ‘Host’ header field; otherwise, the request can’t be executed. 200 | 201 | _request-target:_
202 |       _origin-form_
203 |       _absolute-form_
204 |       _asterisk-form_
205 | 206 | _origin-form:_
207 |       _absolute-path [‘?’ query] [‘#’ fragment]_
208 | 209 | __Example:__ 210 | ``` 211 | GET /api/get 212 | Host: example.com 213 | ``` 214 | 215 | If the request target is a full path, it’s necessary to specify the target authority and optionally the request scheme and path on the server. ‘http’ will be used as a default value if scheme is not specified. 216 | 217 | _absolute-form:_
218 |       _[scheme ‘://’] hier-part [‘?’ query] [‘#’ fragment]_
219 | 220 | _scheme:_
221 |       _‘http’_
222 |       _‘https’_
223 | 224 | _hier-part:_
225 |       _authority [absolute-path]_
226 | 227 | __Example:__ 228 | ``` 229 | GET http://example.com/api/get 230 | ``` 231 | 232 | The asterisk form can be used for a server-wide OPTIONS request. 233 | 234 | _asterisk-form:_
235 |       _‘*’_
236 | 237 | __Example:__ 238 | ``` 239 | OPTIONS * HTTP/1.1 240 | Host: http://example.com:8080 241 | ``` 242 | Absolute-form and authority-form from the HTTP message format were combined into a simplified absolute-form version. 243 | #### 3.2.1.2. Authority 244 | Authority is a target host and port. A host can be represented by the IPv4 or IPv6 address, or by a host name. 245 | 246 | _authority:_
247 |       _host [‘:’ port]_
248 | _port:_
249 |       _(digit)+_
250 | 251 | _host:_
252 |       _‘[‘ ipv6-address ‘]’_
253 |       _ipv4-or-reg-name_
254 | 255 | _ipv6-address:_
256 |       _(any input-character except ‘/’ and ‘]’)+_
257 | _ipv4-or-reg-name:_
258 |       _(any input-character except ‘/’, ‘:’, ‘?’ and ‘#’)+_
259 | 260 | __Example:__ 261 | ``` 262 | http://[::1] 263 | ``` 264 | ``` 265 | http://127.0.0.1:8080 266 | ``` 267 | ``` 268 | http://example.com 269 | ``` 270 | 271 | HTTP Request in Editor supports unicode characters as part of request authority. 272 | #### 3.2.1.3. Resource path 273 | The resources path on the server is represented by a number of segments separated by ‘/’ or line separators. A path segment may contain any unicode symbol except line separator, ‘/‘, ‘?’ and ‘#’. A path ends after a new line without indent or after the ‘?’ or the ‘#’ symbols. 274 | 275 | _absolute-path:_
276 |       _‘/’_
277 |       _(path-separator segment)+_
278 | 279 | _path-separator:_
280 |       _‘/’_
281 |       _new-line-with-indent_
282 | 283 | _segment:_
284 |       _(any input-character except ‘/’, ‘?’ and ‘#’)*_
285 | 286 | HTTP Request in Editor supports unicode characters as part of a resources path. A resources path can be split into several lines for better request readability. Line separators won’t be sent as part of the request during execution. 287 | #### 3.2.1.4. Query and Fragment 288 | A request query may contain any unicode characters except line separators and the ‘#’ symbol. 289 | 290 | _query:_
291 |       _(any input-character except ‘#’)* [new-line-with-indent query]_
292 | 293 | 294 | __Example:__ 295 | ``` 296 | http://example.com/api/get?id=42 297 | ``` 298 | 299 | A request fragment may contain any unicode characters except line separators and the ‘?’ symbol. 300 | The fragment part of a URL is used only on a client side; therefore, it won’t be sent as part of the request. 301 | 302 | _fragment:_
303 |       _(any input-character except ‘?’)* [new-line-with-indent fragment]_
304 | 305 | __Example:__ 306 | ``` 307 | http://example.com/api/get#q=hello+world 308 | ``` 309 | 310 | All non-ASCII symbols in path and query are encoded before sending; the already encoded symbols must not be encoded twice. For example, ‘%20’ must be inserted as ‘%2520’ to be sent as part of the path. 311 | 312 | HTTP Request in Editor supports unicode characters as part of the request query and fragment. 313 | ### 3.2.2. Headers 314 | Each header field consists of a case-insensitive field name followed by a colon (‘:’), optional leading whitespace, the field value, and optional trailing whitespace. 315 | 316 | Header fields are send as is without encoding. 317 | 318 | _headers:_
319 |       _(header-field new-line)*_
320 | 321 | _header-field:_
322 |       _field-name ‘:’ optional-whitespace field-value optional-whitespace_
323 | 324 | _field-name:_
325 |       _(any input-character except ‘:’)+_
326 | 327 | _field-value:_
328 |       _line-tail [new-line-with-indent field-value]_
329 | 330 | __Example:__ 331 | ``` 332 | GET http://example.com/api/get?id=15 333 | From: user@example.com 334 | ``` 335 | ### 3.2.3. Message body 336 | The message body can be represented as a simple message or a mixed type message (multipart-form-data). A request message can be inserted in-place or from a file. 337 | 338 | _message-body:_
339 |       _messages_
340 |       _multipart-form-data_
341 | 342 | _messages:_
343 |       _message-line [ new-line message-line ]_
344 | 345 | _message-line:_
346 |       _(any input-character except ‘< ’, ’<> ’ and ‘###’) line-tail_
347 |       _input-file-ref_
348 | 349 | _input-file-ref:_
350 |       _‘<’ required-whitespace file-path_
351 | 352 | _file-path:_
353 |       _line-tail_
354 | 355 | __Example:__ 356 | ``` 357 | POST http://example.com/api/add 358 | Content-Type: application/json 359 | 360 | { “key”: “value” } 361 | ``` 362 | Or 363 | ``` 364 | POST http://example.com/api/add 365 | Content-Type: application/json 366 | 367 | < ./input.json 368 | ``` 369 | Unlike the HTTP message format, the HTTP Request in Editor format supports sending the message body from a separate file. 370 | 371 | #### 3.2.3.1. Multipart-form-data 372 | Multipart form data is a mixed message body consisting of several multipart fields separated by a boundary. A multipart field consists of optional header fields and a simple request message. Message body type and multipart boundary should be defined in the ‘Content-Type’ request header field. 373 | 374 | _multipart-form-data:_
375 |       _multipart-field [multipart-form-data] boundary_
376 | 377 | _multipart-field:_
378 |       _boundary (header-field new-line)* new-line [messages]_
379 | 380 | __Example:__ 381 | ``` 382 | POST http://example.com/api/upload 383 | Content-Type: multipart/form-data; boundary=abcd 384 | 385 | --abcd 386 | Content-Disposition: form-data; name="text" 387 | 388 | Text 389 | --abcd 390 | Content-Disposition: form-data; name="file_to_send"; filename="input.txt" 391 | 392 | < ./input.txt 393 | --abcd-- 394 | ``` 395 | 396 | ### 3.2.4. Response handler 397 | A custom response handler script can be specified at the end of the request to capture and save information from the response to a global variable, or to perform assertions. 398 | A script can be inserted in-place or by referencing a separate file. An in-place script can’t contain ‘%}’ or request separator (‘###’). 399 | 400 | 401 | _response-handler:_
402 |       _‘>’ required-whitespace ‘{%’ handler-script ‘%}’_
403 |       _‘>’ required-whitespace file-path_
404 | 405 | __Example:__ 406 | ``` 407 | GET http://example.com/auth 408 | 409 | > {% client.global.set("auth", response.body.token);%} 410 | ``` 411 | 412 | The response handler section is not defined in the HTTP message format; it was introduced in HTTP Request in Editor. 413 | ### 3.2.5. Response reference 414 | A reference to a previously received response is represented with the ‘<> ’ symbol and the path to a file. References are used to provide easy access to the requests execution history. The section may be useful for comparing different responses. 415 | 416 | _response-ref:_
417 |       _‘<>’ required-whitespace file-path_
418 | 419 | __Example:__ 420 | ``` 421 | GET http://example.com 422 | 423 | <> previous-response.200.json 424 | ``` 425 | The response reference section is not defined in the HTTP message format; it was introduced in HTTP Request in Editor. 426 | 427 | ### 3.2.6. Environment variables 428 | Environment variables are used for avoiding unnecessary data duplication in requests or for providing an easy way of switching between the development and production environments. They can be used inside request target, header fields and message body. 429 | Each environment variable is represented by a case-sensitive identifier surrounded by double curly braces. 430 | 431 | _env-variable:_
432 |       _‘{{’ optional-whitespace identifier optional-whitespace ‘}}’_
433 | 434 | __Example:__ 435 | ``` 436 | GET http://{{host}}/api/get?id={{ element-id }} 437 | ``` 438 | 439 | Environment variables are not defined in the HTTP message format; they were introduced in HTTP Request in Editor. 440 | 441 | # 4. Execution 442 | __TODO:__ describe request execution process: preprocessing (decoding and encoding, whitespace trimming), variable substitution, execution, response handler (update global variables, perform assertions). 443 | ## 4.1. Encoding 444 | ### 4.1.1. Host 445 | __TODO:__ specify how non-ASCII symbols in host should be handled. [RFC3986](https://tools.ietf.org/html/rfc3986#section-3.2.2) 446 | 447 | ### 4.1.2. Resource path and query 448 | All non-ASCII symbols in path and query are encoded before sending; the already encoded symbols must not be encoded twice. For example, ‘%20’ must be inserted as ‘%2520’ to be sent as part of the path. 449 | 450 | ### 4.1.3. Request body 451 | Request body should be encoded according to the ‘Content-Type’ header field. If it’s not specified, the ‘UTF-8’ encoding should be used. 452 | 453 | ## 4.2. Whitespaces 454 | ### 4.2.1. Resource path and query 455 | Whitespaces around each line of the request path and the query will be trimmed. To send leading or trailing whitespaces, use the encoded version. 456 | 457 | __Example:__ 458 | ``` 459 | http://example.com/ 460 | api 461 | /get 462 | ``` 463 | 464 | The request will be sent as “http://example.com/api/get”. 465 | 466 | __Example:__ 467 | ``` 468 | http://example.com/ 469 | %20api%20 470 | +/get+ 471 | ``` 472 | The request will be sent as “http://example.com/ api / get ”. 473 | 474 | ### 4.2.2. Request body 475 | If the request body is configured in-place, whitespaces around it will be trimmed. To send leading or trailing whitespaces as part of the request body, send it from a separate file. 476 | 477 | __Example:__ 478 | ``` 479 | ### 480 | POST http://example.com/add 481 | 482 | 483 | message-body 484 | 485 | ### 486 | ``` 487 | 488 | Only “message-body” will be send as the request body. 489 | 490 | __Example:__ 491 | ``` 492 | ### 493 | POST http://example.com/add 494 | 495 | < input.txt 496 | ### 497 | ``` 498 | 499 | _input.txt:_ 500 | ``` 501 | 502 | message-body 503 | 504 | ``` 505 | 506 | The whole content of the ‘input.txt’ will be send as request body, i.e. “\nmessage-body\n”. 507 | 508 | ## 4.3. Multipart/form-data 509 | Multipart form body part can be sent either as a file or as a plain string body. Which one to use is regulated by the ‘filename’ option in the body part header. 510 | 511 | __Example:__
512 | The first body part will be sent as a string and the second one – as a file. 513 | ``` 514 | POST http://example.com/api/upload 515 | Content-Type: multipart/form-data; boundary=abcd 516 | 517 | --abcd 518 | Content-Disposition: form-data; name="text" 519 | 520 | Text 521 | --abcd 522 | Content-Disposition: form-data; name="file_to_send"; filename="input.txt" 523 | 524 | < ./input.txt 525 | --abcd-- 526 | ``` 527 | ## 4.4 Environment variables 528 | __TODO:__ how to define environment, how value is inserted 529 | 530 | ## 4.5 Response handler script 531 | Response handler script should be written in JavaScript [ECMAScript 5.1 specification](https://www.ecma-international.org/ecma-262/5.1/) 532 | 533 | __TODO:__ describe API available in response handler script 534 | --------------------------------------------------------------------------------