<commit_before># Middle - Go middleware
A simple middleware handler for your HTTP requests

### Basic usage
```go
func middleware1(w http.ResponseWriter, r *http.Request) bool {
    if ok := someCheck(r); !ok {
        // stops the request chain
        return false
    }
    // continue to the next middleware
    return true
}

func yourHttpRequest(w http.ResponseWriter, r *http.Request) {
    w.Write([]byte("Hello simple middleware")
}

m := middle.New()
m.UseBefore(middleware1, middleware2)
m.UseAfter(middleware3, middleware4)

http.HandleFunc("/", m.Then(yourHttpRequest))
```

### Using chaing
Chain your middlewares in the http handler
```go
m := middle.New()
m.UseBefore(middleware1)

http.HandleFunc("/one", m.Before(middleware2).Then(request))
http.HandleFunc("/two", m.Before(middleware3).After(middleware4).Then(request))
```

### Wrap the request
```go
func wrapper(w http.ResponseWriter, r *http.Request, next middle.Request) {
    w.Write([]byte("Ex: open database connection")
    next(w, r)
    w.Write([]byte("Close the connection")
}

m := middle.New()
m.UseWrap(wrapper)

http.HandleFunc("/", m.Wrap(wrapper).Then(request))
```<commit_msg>Fixed typo<commit_after># Middle - Go middleware
A simple middleware handler for your HTTP requests

### Basic usage
```go
func middleware1(w http.ResponseWriter, r *http.Request) bool {
    if ok := someCheck(r); !ok {
        // stops the request chain
        return false
    }
    // continue to the next middleware
    return true
}

func yourHttpRequest(w http.ResponseWriter, r *http.Request) {
    w.Write([]byte("Hello simple middleware")
}

m := middle.New()
m.UseBefore(middleware1, middleware2)
m.UseAfter(middleware3, middleware4)

http.HandleFunc("/", m.Then(yourHttpRequest))
```

### Using chaining
Chain your middlewares in the http handler
```go
m := middle.New()
m.UseBefore(middleware1)

http.HandleFunc("/one", m.Before(middleware2).Then(request))
http.HandleFunc("/two", m.Before(middleware3).After(middleware4).Then(request))
```

### Wrap the request
```go
func wrapper(w http.ResponseWriter, r *http.Request, next middle.Request) {
    w.Write([]byte("Ex: open database connection")
    next(w, r)
    w.Write([]byte("Close the connection")
}

m := middle.New()
m.UseWrap(wrapper)

http.HandleFunc("/", m.Wrap(wrapper).Then(request))
```
{'fraction_non_alphanumeric': 0.15384615384615385, 'fraction_numerical': 0.007735281478298238, 'mean_word_length': 4.490566037735849, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1106285', 'n_tokens_mistral': 759, 'n_tokens_neox': 746, 'n_words': 193}