Skip to content

Commit

Permalink
fix & bump
Browse files Browse the repository at this point in the history
  • Loading branch information
Clivern committed Oct 3, 2020
1 parent 8f04c13 commit bd55394
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM golang:1.15.2

ARG RHINO_VERSION=1.2.0
ARG RHINO_VERSION=1.2.1

ENV GO111MODULE=on

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<p align="center">
<img alt="Rhino Logo" src="https://raw.githubusercontent.com/clivern/Rhino/master/assets/img/gopher.png?v=1.2.0" width="150" />
<img alt="Rhino Logo" src="https://raw.githubusercontent.com/clivern/Rhino/master/assets/img/gopher.png?v=1.2.1" width="150" />
<h3 align="center">Rhino</h3>
<p align="center">HTTP Mocking & Debugging Service</p>
<p align="center">
<a href="https://travis-ci.com/Clivern/Rhino"><img src="https://travis-ci.com/Clivern/Rhino.svg?branch=master"></a>
<a href="https://github.com/Clivern/Rhino/releases"><img src="https://img.shields.io/badge/Version-1.2.0-red.svg"></a>
<a href="https://goreportcard.com/report/github.com/Clivern/Rhino"><img src="https://goreportcard.com/badge/github.com/clivern/Rhino?v=1.2.0"></a>
<a href="https://github.com/Clivern/Rhino/releases"><img src="https://img.shields.io/badge/Version-1.2.1-red.svg"></a>
<a href="https://goreportcard.com/report/github.com/Clivern/Rhino"><img src="https://goreportcard.com/badge/github.com/clivern/Rhino?v=1.2.1"></a>
<a href="https://hub.docker.com/r/clivern/rhino"><img src="https://img.shields.io/badge/Docker-Latest-green"></a>
<a href="https://github.com/Clivern/Rhino/blob/master/LICENSE"><img src="https://img.shields.io/badge/LICENSE-MIT-orange.svg"></a>
</p>
Expand Down
11 changes: 7 additions & 4 deletions core/controller/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package controller

import (
"bytes"
"encoding/json"
"io/ioutil"
"math/rand"
"net/http"
Expand All @@ -30,14 +29,18 @@ func Debug(c *gin.Context) {
}

c.Request.Body = ioutil.NopCloser(bytes.NewBuffer(bodyBytes))
header, _ := json.Marshal(c.Request.Header)

parameters := make(map[string]string)
headers := make(map[string]string)

for k, v := range c.Request.URL.Query() {
parameters[k] = v[0]
}

for k, v := range c.Request.Header {
headers[k] = v[0]
}

route := model.GetRoute(c.FullPath(), "", parameters)

rand.Seed(time.Now().UnixNano())
Expand All @@ -48,7 +51,7 @@ func Debug(c *gin.Context) {
log.WithFields(log.Fields{
"method": c.Request.Method,
"url": c.Request.URL.Path,
"header": header,
"headers": headers,
"parameters": parameters,
"body": string(bodyBytes),
}).Info("Failed Request")
Expand All @@ -64,7 +67,7 @@ func Debug(c *gin.Context) {
log.WithFields(log.Fields{
"method": c.Request.Method,
"url": c.Request.URL.Path,
"header": header,
"headers": headers,
"parameters": parameters,
"body": string(bodyBytes),
}).Info("Request Success")
Expand Down
12 changes: 7 additions & 5 deletions core/controller/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package controller

import (
"bytes"
"encoding/json"
"io/ioutil"
"math/rand"
"net/http"
Expand All @@ -32,14 +31,17 @@ func Mock(c *gin.Context) {

c.Request.Body = ioutil.NopCloser(bytes.NewBuffer(bodyBytes))

header, _ := json.Marshal(c.Request.Header)

parameters := make(map[string]string)
headers := make(map[string]string)

for k, v := range c.Request.URL.Query() {
parameters[k] = v[0]
}

for k, v := range c.Request.Header {
headers[k] = v[0]
}

route := model.GetRoute(c.FullPath(), c.Request.Method, parameters)

rand.Seed(time.Now().UnixNano())
Expand All @@ -50,7 +52,7 @@ func Mock(c *gin.Context) {
log.WithFields(log.Fields{
"method": c.Request.Method,
"url": c.Request.URL.Path,
"header": header,
"headers": headers,
"parameters": parameters,
"body": string(bodyBytes),
}).Info("Failed Request")
Expand All @@ -66,7 +68,7 @@ func Mock(c *gin.Context) {
log.WithFields(log.Fields{
"method": c.Request.Method,
"url": c.Request.URL.Path,
"header": header,
"headers": headers,
"parameters": parameters,
"body": string(bodyBytes),
}).Info("Request Success")
Expand Down
2 changes: 1 addition & 1 deletion deployment/docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3'
services:
rhino:
image: 'clivern/rhino:release-1.2.0'
image: 'clivern/rhino:release-1.2.1'
ports:
- "8080:8080"
command: '/app/rhino serve -c /app/configs/config.prod.json'
Expand Down

0 comments on commit bd55394

Please sign in to comment.