github.com/solo-io/cue@v0.4.7/pkg/tool/http/http.cue (about)

     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  
    15  package http
    16  
    17  Get:    Do & {method: "GET"}
    18  Post:   Do & {method: "POST"}
    19  Put:    Do & {method: "PUT"}
    20  Delete: Do & {method: "DELETE"}
    21  
    22  Do: {
    23  	$id: *"tool/http.Do" | "http" // http for backwards compatibility
    24  
    25  	method: string
    26  	url:    string // TODO: make url.URL type
    27  
    28  	request: {
    29  		body?: bytes | string
    30  		header: [string]:  string | [...string]
    31  		trailer: [string]: string | [...string]
    32  	}
    33  	response: {
    34  		status:     string
    35  		statusCode: int
    36  
    37  		body: *bytes | string
    38  		header: [string]:  string | [...string]
    39  		trailer: [string]: string | [...string]
    40  	}
    41  }
    42  
    43  //  TODO: support serving once we have the cue serve command.
    44  // Serve: {
    45  //  port: int
    46  //
    47  //  cert: string
    48  //  key:  string
    49  //
    50  //  handle: [Pattern=string]: Message & {
    51  //   pattern: Pattern
    52  //  }
    53  // }