Code Monkey home page Code Monkey logo

echox's People

Contributors

4lisalehi avatar aaron0x avatar acidvertigo avatar aldas avatar bruc3mackenzi3 avatar captaincodeman avatar dependabot[bot] avatar jrschumacher avatar konfortes avatar lammel avatar mohammadhz98 avatar mtgto avatar n1kolas avatar nipeharefa avatar planutim avatar qalifah avatar rafaeljusto avatar rfguri avatar royragsdale avatar safaci2000 avatar scott8440 avatar serdar-irmak avatar shihanng avatar suisant1 avatar thomasklein94 avatar tk103331 avatar tmshn avatar tomruk avatar vishr avatar zjx20 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

echox's Issues

Error on CURD example

I've try echo example and found an error on CRUD
the first one is

./server.go:72: e.DELETE undefined (type *echo.Echo has no field or method DELETE, but does have Delete)

then I just comment that line and
found another one when send POST request to localhost:1323/users it return response

Unsupported Media Type

JWT Example shows timing attack

In https://echo.labstack.com/cookbook/jwt , == results in a timing attack (even if you are comparing hashes like this: hash(webPassword) == savedHashedPassword).

The example code should probably have at least a comment // example only; string comparisons are vulnerable to timing attacks and perhaps another comment that even just hashed passwords should use the timing-attack-resistant comparison functions within the hash library, rather than a regular == string comparison.

JWT not checking for expiration?

Hi,

I just ran your JWT example code and I wonder why the middleware throws no 401 after the token expired?
I changed the time.Hour to time.Second, waited 10 seconds and I could still access the /restricted route where it prints Welcome Jon Snow.
Did I miss something?

claims["exp"] = time.Now().Add(time.Second * 10).Unix()

streaming-response errors

Greetings,

I have just started playing around with the echo & echox frameworks and was able to compile and run the jsonp recipe, but had some problems when it came to testing the streaming-response recipe:

lonnie@spartan:~/work/streaming-response$ go build server.go

command-line-arguments

./server.go:34: undefined: echo.ContentType
./server.go:34: undefined: echo.ApplicationJSON

Can you please advice what may be happening as I am running on Ubuntu 15.04 and have installed:

go version go1.6 linux/amd64

cheers,
Lonnie

Docs for request example, Validate Data, error is --> not enough arguments in call to validator.New

Hi Guys
Please help check below issue. thanks!

https://echo.labstack.com/guide/request
example is Validate Data

package main

import (
"gopkg.in/go-playground/validator.v8"
"github.com/labstack/echo"
"net/http"
)

type (
User struct {
Name string json:"name" validate:"required"
Email string json:"email" validate:"required,email"
}

CustomValidator struct {
	validator *validator.Validate
}

)

func (cv *CustomValidator) Validate(i interface{}) error {
return cv.validator.Struct(i)
}

func main() {
e := echo.New()
e.Validator = &CustomValidator{validator: validator.New()}
e.POST("/users", func(c echo.Context) (err error) {
u := new(User)
if err = c.Bind(u); err != nil {
return
}
if err = c.Validate(u); err != nil {
return
}
return c.JSON(http.StatusOK, u)
})
e.Logger.Fatal(e.Start(":1323"))
}

command-line-arguments

./server3.go:26:57: not enough arguments in call to validator.New
have ()
want (*validator.Config)

Key Auth

Written as:

e.Use(middleware.KeyAuth(func(key string) (bool, error) {
  return key == "valid-key", nil
}))

Should be:

e.Use(middleware.KeyAuth(func(key string, c echo.Context) (error, bool) {
  return nil, key == "valid-key"
}))

echo.labstack.com is down?

Site appears to be down.

Workaround: was able to clone this project, brew install hugo and then serve the site with Hugo locally. Pretty cool.

Please add a license to this repo

Could you please add an explicit LICENSE file to the repo so that it's clear under what terms the content is provided, and under what terms user contributions are licensed?

Per GitHub docs on licensing:

[...] without a license, the default copyright laws apply, meaning that you retain all rights to your source code and no one may reproduce, distribute, or create derivative works from your work. If you're creating an open source project, we strongly encourage you to include an open source license.

Thanks!

update example to v2

  1. jwt need github.com/dgrijalva/jwt-go please don't del it.
  2. google-app-engine has many problem.
  3. file-upload has bug, it says:
# command-line-arguments
.\main.go:25: req.MultipartForm.File undefined (type func() (*multipart.Form, error) has no field or method File)

Playground Validator doesn't work

I follow this documentation -> https://echo.labstack.com/guide/request

My code is:

main.go

package main

import (
	"github.com/labstack/echo"
	"gopkg.in/go-playground/validator.v9"
)

type CustomValidator struct {
	validator *validator.Validate
}

func (cv *CustomValidator) Validate(i interface{}) error {
	return cv.validator.Struct(i)
}

func main() {
	e := echo.New()
	e.Validator = &CustomValidator{validator: validator.New()}

	// TODOS
	e.GET("/todos", getTodos)
	e.POST("/todos", createTodo)

	e.Logger.Fatal(e.Start(":1323"))
}

todo.go

package main

import (
	"github.com/labstack/echo"
)

type Todo struct {
	Title string `json:"title" validate:"required"`
}

var todos = []Todo {
	{
		Title: "Saugen",
	},
}

func getTodos(c echo.Context) error {
	return c.JSONPretty(200, map[string][]Todo {
		"todos": todos,
	}, "    ")
}

func createTodo(c echo.Context) (err error) {
	todo := new(Todo)
	if err = c.Bind(todo); err != nil {
		return
	}
	if err = c.Validate(todo); err != nil {
		return
	}
	todos = append(todos, *todo)
	return c.JSONPretty(200, *todo, "    ")
}

My payload is:

{
	"title": ""
}

My result is:

{
    "message": "Internal Server Error"
}

which should not be!

Console output:

{"time":"2018-03-08T20:51:49.3489642+01:00","level":"ERROR","prefix":"echo","file":"echo.go","line":"286","message":"Key: 'Todo.Title' Error:Field validation for 'Title' failed on the 'required' tag"}

JWT Authentication

my env: win10/amd64/go-1.6
when use

# Valid token
$  curl localhost:1323/restricted -H "Authorization: Bearer <token>" 

it gets not "Access granted with JWT" but nothing.

it seems func restricted(){...} not executed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.