gudong

command module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

README

How to use

Start a tiny http server using gudong.

$ ./gudong start -B=hello,world!

Call gudong server and you will get the specified response.

$ curl http://localhost:7777/mock.do -d mytest
hello,world! 

You can check up the request headers and body in standard output of gudong.

$ ./target/gudong start -B=hello,world! 
POST /mock.do HTTP/1.1
HOST : localhost:7777
Content-Type : application/x-www-form-urlencoded
User-Agent : curl/7.54.0
Accept : */*
Content-Length : 6

mytest
========================================
#                gudong                #
========================================

Using files to specify response.

$ cat > headers  <<EOF                  
Custom-Header : This is a custom header
EOF

$ cat > body  <<EOF                  
Hello,world!
EOF

$ ./gudong start --header-file=headers --body-file=body

Using gudong start -h to see more.

$ ./gudong start -h                      
This tiny server print http request header and body to Standard output, 
                and return the response specified by -H or -B flag.

Usage:
  gudong start [flags]

Flags:
  -B, --body string          specify response body by string
      --body-file string     specify response body by file (if --body-file is specified, -B will be ignored)
  -H, --header string        specify response header by string (multi-headers separate by ;)
      --header-file string   specify response header by file (if --header-file is specified, -H will be ignored)
  -h, --help                 help for start
  -c, --no-chunked           specify body transfer encoding with noChunked when using --body-file
  -p, --port string          specify http server port (default "7777")
  -r, --read-timeout int     specify http server read timeout (ms) (default 3000)
  -w, --write-timeout int    specify http server write timeout (ms) (default 3000)

About gudong

gudong's comming is a Chinese fable.

About cobra

Cobra is both a library for creating powerful modern CLI applications as well as a program to generate applications and command files.

Documentation

Overview

Copyright © 2019 yixy <youzhilane01@gmail.com>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL