Skip to content

Commit

Permalink
[DFI-842] post method for vm rest compiler (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
g3co authored Oct 22, 2020
1 parent 18871c7 commit 56604f0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/dncli/docs/swagger.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion helpers/tests/clitester/cli_tester_rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ func (ct *CLITester) RestQueryVMCompile(address, code string) (*RestRequest, *vm
reqSubPath := fmt.Sprintf("%s/%s", vm.ModuleName, "compile")
respMsg := &vm_client.CompiledItems{}

r := ct.newRestRequest().SetQuery("GET", reqSubPath, nil, req, respMsg)
r := ct.newRestRequest().SetQuery("POST", reqSubPath, nil, req, respMsg)

return r, respMsg
}
Expand Down
4 changes: 2 additions & 2 deletions x/vm/client/rest/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ type LcsViewResp struct {

// Registering routes for REST API.
func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router) {
r.HandleFunc(fmt.Sprintf("/%s/compile", types.ModuleName), compile(cliCtx)).Methods("GET")
r.HandleFunc(fmt.Sprintf("/%s/compile", types.ModuleName), compile(cliCtx)).Methods("POST")
r.HandleFunc(fmt.Sprintf("/%s/data/{%s}/{%s}", types.ModuleName, accountAddrName, vmPathName), getData(cliCtx)).Methods("GET")
r.HandleFunc(fmt.Sprintf("/%s/view", types.ModuleName), lcsView(cliCtx)).Methods("GET")
r.HandleFunc(fmt.Sprintf("/%s/tx/{%s}", types.ModuleName, txHash), getTxVMStatus(cliCtx)).Methods("GET")
Expand All @@ -82,7 +82,7 @@ func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router) {
// @Success 200 {object} VmRespCompile
// @Failure 400 {object} rest.ErrorResponse "Returned if the request doesn't have valid query params"
// @Failure 500 {object} rest.ErrorResponse "Returned on server error"
// @Router /vm/compile [get]
// @Router /vm/compile [post]
func compile(cliCtx context.CLIContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
compilerAddr := viper.GetString(vm_client.FlagCompilerAddr)
Expand Down

0 comments on commit 56604f0

Please sign in to comment.