func httpRequestMiddleware(event *Event, config *Configuration) error {
	for _, datum := range event.RawData {
		if request, ok := datum.(*http.Request); ok {
			proto := "http://"
			if request.TLS != nil {
				proto = "https://"
			}
			event.MetaData.Update(MetaData{
				"request": {
					"remoteAddr": request.RemoteAddr,
					"method":     request.Method,
					"url":        proto + request.Host + request.RequestURI,
					"params":     request.URL.Query(),
				},
			})
			event.MetaData.AddStruct("Headers", request.Header)
			if event.Context == "" {
				event.Context = request.URL.Path
			}
			if event.User == nil {
				ip := request.RemoteAddr
				if idx := strings.LastIndex(ip, ":"); idx != -1 {
					ip = ip[:idx]
				}
				event.User = &User{Id: ip}
			}
		}
	}
	return nil
}
httpRequestMiddleware is added OnBeforeNotify by default. It takes information
from an http.Request passed in as rawData, and adds it to the Event. You can
use this as a template for writing your own Middleware.
package bugsnag
import (
	"net/http"
	"strings"
)
type (
	beforeFunc func(*Event, *Configuration) error
	middlewareStack struct {
		before []beforeFunc
	}
)
func (stack *middlewareStack) OnBeforeNotify(middleware beforeFunc) {
	stack.before = append(stack.before, middleware)
}
func (stack *middlewareStack) Run(event *Event, config *Configuration, next func() error) error {
	for i := range stack.before {
		before := stack.before[len(stack.before)-i-1]
		err := stack.runBeforeFilter(before, event, config)
		if err != nil {
			return err
		}
	}
	return next()
}
func (stack *middlewareStack) runBeforeFilter(f beforeFunc, event *Event, config *Configuration) error {
	defer func() {
		if err := recover(); err != nil {
			config.logf("bugsnag/middleware: unexpected panic: %v", err)
		}
	}()
	return f(event, config)
}
func catchMiddlewarePanic(event *Event, config *Configuration, next func() error) {
}