mirror of
https://github.com/kataras/iris.git
synced 2026-01-08 04:21:57 +00:00
formatting
Former-commit-id: 037081db5d6d4434e873ca8b75334ee43e046b6a
This commit is contained in:
@@ -131,7 +131,6 @@ func main() {
|
||||
// hooks right into validator and you can combine with validation tags and still have a
|
||||
// common error output format.
|
||||
func UserStructLevelValidation(sl validator.StructLevel) {
|
||||
|
||||
user := sl.Current().Interface().(User)
|
||||
|
||||
if len(user.FirstName) == 0 && len(user.LastName) == 0 {
|
||||
|
||||
@@ -32,7 +32,6 @@ type Person struct {
|
||||
func MyHandler2(ctx iris.Context) {
|
||||
var persons []Person
|
||||
err := ctx.ReadJSON(&persons)
|
||||
|
||||
if err != nil {
|
||||
ctx.StatusCode(iris.StatusBadRequest)
|
||||
ctx.WriteString(err.Error())
|
||||
|
||||
@@ -20,7 +20,6 @@ func main() {
|
||||
ctx.WriteString(`The body was empty
|
||||
or iris.WithoutBodyConsumptionOnUnmarshal option is missing from app.Run.
|
||||
Check the terminal window for any queries logs.`)
|
||||
|
||||
} else {
|
||||
ctx.WriteString("OK body is still:\n")
|
||||
ctx.Write(body)
|
||||
|
||||
@@ -20,7 +20,7 @@ func main() {
|
||||
// Query appends the url query to the Path.
|
||||
Query: true,
|
||||
|
||||
//Columns: true,
|
||||
// Columns: true,
|
||||
|
||||
// if !empty then its contents derives from `ctx.Values().Get("logger_message")
|
||||
// will be added to the logs.
|
||||
@@ -62,5 +62,4 @@ func main() {
|
||||
// http://lcoalhost:8080/notfoundhere
|
||||
// see the output on the console.
|
||||
app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed))
|
||||
|
||||
}
|
||||
|
||||
@@ -113,7 +113,6 @@ func main() {
|
||||
// assuming that you have a folder named 'uploads'
|
||||
out, err := os.OpenFile("./uploads/"+fname,
|
||||
os.O_WRONLY|os.O_CREATE, 0666)
|
||||
|
||||
if err != nil {
|
||||
ctx.StatusCode(iris.StatusInternalServerError)
|
||||
ctx.HTML("Error while uploading: <b>" + err.Error() + "</b>")
|
||||
|
||||
@@ -84,7 +84,6 @@ func saveUploadedFile(fh *multipart.FileHeader, destDirectory string) (int64, er
|
||||
|
||||
out, err := os.OpenFile(filepath.Join(destDirectory, fh.Filename),
|
||||
os.O_WRONLY|os.O_CREATE, os.FileMode(0666))
|
||||
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user