diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/.idea/grpcox.iml b/.idea/grpcox.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/.idea/grpcox.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..28a804d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..85e2b6b --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..6a04253 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1595314841140 + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/resource.go b/core/resource.go index 04819d1..9881e6e 100644 --- a/core/resource.go +++ b/core/resource.go @@ -184,13 +184,15 @@ func (r *Resource) Describe(symbol string) (string, string, error) { } // Invoke - invoking gRPC function -func (r *Resource) Invoke(ctx context.Context, symbol string, in io.Reader) (string, time.Duration, error) { +func (r *Resource) Invoke(ctx context.Context, symbol string, in io.Reader, metadata []string) (string, time.Duration, error) { err := r.openDescriptor() if err != nil { return "", 0, err } defer r.closeDescriptor() + r.headers = metadata + // because of grpcurl directly fmt.Printf on their invoke function // so we stub the Stdout using os.Pipe backUpStdout := os.Stdout diff --git a/handler/handler.go b/handler/handler.go index 373e269..fbaa319 100644 --- a/handler/handler.go +++ b/handler/handler.go @@ -221,8 +221,12 @@ func (h *Handler) invokeFunction(w http.ResponseWriter, r *http.Request) { return } + md := r.Header.Get("metadata") + + mds := strings.Split(md, ",") + // get param - result, timer, err := res.Invoke(context.Background(), funcName, r.Body) + result, timer, err := res.Invoke(context.Background(), funcName, r.Body, mds) if err != nil { writeError(w, err) return diff --git a/index/css/style.css b/index/css/style.css index ae61674..df943d4 100644 --- a/index/css/style.css +++ b/index/css/style.css @@ -11,6 +11,7 @@ body { width: 120px; } .custom-pretty { + height: 500px; border:none!important; } .custom-control-label:hover { @@ -200,4 +201,4 @@ circle { transform: scaleY(1.0); -webkit-transform: scaleY(1.0); } -} \ No newline at end of file +} diff --git a/index/index.html b/index/index.html index e32f9ca..918d89a 100644 --- a/index/index.html +++ b/index/index.html @@ -66,10 +66,9 @@