Cleanup examples

This commit is contained in:
Martin Polden 2016-04-17 11:33:59 +02:00
parent 8f71576357
commit 65d9d8ccf1
1 changed files with 12 additions and 26 deletions

View File

@ -58,32 +58,24 @@ $ wget -qO- ifconfig.co
{{ .IP }} {{ .IP }}
$ fetch -qo- http://ifconfig.co $ fetch -qo- http://ifconfig.co
{{ .IP }} {{ .IP }}</pre>
</pre>
{{ if .IsLookupCountryEnabled }} {{ if .IsLookupCountryEnabled }}
<p>Country lookup:</p> <p>Country lookup:</p>
<pre> <pre>
$ http ifconfig.co/country $ http ifconfig.co/country
{{ .Country }} {{ .Country }}</pre>
</pre>
{{ end }} {{ end }}
{{ if .IsLookupCityEnabled }} {{ if .IsLookupCityEnabled }}
<p>City lookup:</p> <p>City lookup:</p>
<pre> <pre>
$ http ifconfig.co/city $ http ifconfig.co/city
{{ .City }} {{ .City }}</pre>
</pre>
{{ end }} {{ end }}
</div> </div>
<div class="pure-u-1 pure-u-md-1-2"> <div class="pure-u-1 pure-u-md-1-2">
<p>JSON output:</p> <p>JSON output:</p>
<pre> <pre>
$ http ifconfig.co/json $ http ifconfig.co/json
HTTP/1.1 200 OK
Content-Length: 61
Content-Type: application/json
Date: Fri, 15 Apr 2016 17:26:53 GMT
{ {{ if .IsLookupCountryEnabled }} { {{ if .IsLookupCountryEnabled }}
"country": "{{ .Country }}",{{ end }}{{ if .IsLookupCityEnabled }} "country": "{{ .Country }}",{{ end }}{{ if .IsLookupCityEnabled }}
"city": "{{ .City }}",{{ end }}{{ if .IsLookupAddrEnabled }} "city": "{{ .City }}",{{ end }}{{ if .IsLookupAddrEnabled }}
@ -91,24 +83,18 @@ Date: Fri, 15 Apr 2016 17:26:53 GMT
"ip": "{{ .IP }}" "ip": "{{ .IP }}"
} }
# or set Accept header to application/json: # or set Accept header:
# http --json ifconfig.co # http ifconfig.co Accept:application/json</pre>
</pre>
{{ if .IsLookupPortEnabled }}
<p>Testing port connectivity (only supports JSON output):</p>
<pre>
http --json localhost:8080/port/8080
HTTP/1.1 200 OK
Content-Length: 47
Content-Type: application/json
Date: Fri, 15 Apr 2016 18:47:20 GMT
{{ if .IsLookupPortEnabled }}
<p>Testing port connectivity:</p>
<pre>
$ http ifconfig.co/port/8080
{ {
"ip": "127.0.0.1", "ip": "{{ .IP }}",
"port": 8080, "port": 8080,
"reachable": true "reachable": false
} }</pre>
</pre>
{{ end }} {{ end }}
</div> </div>
</div> </div>