func createCollectionHandler(r render.Render, collection Collection) { collection.StoreId = aipOption.Store.Id err := collection.create() if err != nil { if appErr, ok := err.(*appError); ok { r.JSON(500, appErr.Error()) return } else { logError(err.Error()) r.JSON(500, "error") return } } location := fmt.Sprintf("/api/v1/collections/%d", collection.Id) r.Header().Add("location", location) r.Status(201) }