...
1// Copyright 2018 The CUE Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package http
16
17Get: Do & {method: "GET"}
18Post: Do & {method: "POST"}
19Put: Do & {method: "PUT"}
20Delete: Do & {method: "DELETE"}
21
22Do: {
23 $id: *"tool/http.Do" | "http" // http for backwards compatibility
24
25 method: string
26 url: string // TODO: make url.URL type
27
28 tls: {
29 // Whether the server certificate must be validated.
30 verify: *true | bool
31 // PEM encoded certificate(s) to validate the server certificate.
32 // If not set the CA bundle of the system is used.
33 caCert?: bytes | string
34 }
35
36 request: {
37 body?: bytes | string
38 header: [string]: string | [...string]
39 trailer: [string]: string | [...string]
40 }
41 response: {
42 status: string
43 statusCode: int
44
45 body: *bytes | string
46 header: [string]: string | [...string]
47 trailer: [string]: string | [...string]
48 }
49}
50
51// TODO: support serving once we have the cue serve command.
52// Serve: {
53// port: int
54//
55// cert: string
56// key: string
57//
58// handle: [Pattern=string]: Message & {
59// pattern: Pattern
60// }
61// }
View as plain text