Golang 1.5 and gzip
This commit is contained in:
parent
12b460db9a
commit
44387aa14b
68 changed files with 347 additions and 85 deletions
9
Godeps/Godeps.json
generated
9
Godeps/Godeps.json
generated
|
@ -1,6 +1,9 @@
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/thermokarst/bactdb",
|
"ImportPath": "github.com/thermokarst/bactdb",
|
||||||
"GoVersion": "go1.4.2",
|
"GoVersion": "go1.5",
|
||||||
|
"Packages": [
|
||||||
|
"./..."
|
||||||
|
],
|
||||||
"Deps": [
|
"Deps": [
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/DavidHuie/gomigrate",
|
"ImportPath": "github.com/DavidHuie/gomigrate",
|
||||||
|
@ -45,6 +48,10 @@
|
||||||
"ImportPath": "github.com/mbanzon/simplehttp",
|
"ImportPath": "github.com/mbanzon/simplehttp",
|
||||||
"Rev": "04c542e7ac706a25820090f274ea6a4f39a63326"
|
"Rev": "04c542e7ac706a25820090f274ea6a4f39a63326"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"ImportPath": "github.com/nytimes/gziphandler",
|
||||||
|
"Rev": "05ffaf97c37e486a9b983089cc4865a1b0a9a651"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/thermokarst/jwt",
|
"ImportPath": "github.com/thermokarst/jwt",
|
||||||
"Rev": "7752009bbb5cea39ab392a846c467eab4b98478f"
|
"Rev": "7752009bbb5cea39ab392a846c467eab4b98478f"
|
||||||
|
|
2
Godeps/_workspace/src/github.com/DavidHuie/gomigrate/gomigrate_test.go
generated
vendored
2
Godeps/_workspace/src/github.com/DavidHuie/gomigrate/gomigrate_test.go
generated
vendored
|
@ -8,7 +8,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
_ "github.com/go-sql-driver/mysql"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
_ "github.com/lib/pq"
|
_ "github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/lib/pq"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
2
Godeps/_workspace/src/github.com/codegangsta/cli/app_test.go
generated
vendored
2
Godeps/_workspace/src/github.com/codegangsta/cli/app_test.go
generated
vendored
|
@ -6,7 +6,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/codegangsta/cli"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/codegangsta/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ExampleApp() {
|
func ExampleApp() {
|
||||||
|
|
2
Godeps/_workspace/src/github.com/codegangsta/cli/cli_test.go
generated
vendored
2
Godeps/_workspace/src/github.com/codegangsta/cli/cli_test.go
generated
vendored
|
@ -3,7 +3,7 @@ package cli_test
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/codegangsta/cli"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/codegangsta/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Example() {
|
func Example() {
|
||||||
|
|
2
Godeps/_workspace/src/github.com/codegangsta/cli/command_test.go
generated
vendored
2
Godeps/_workspace/src/github.com/codegangsta/cli/command_test.go
generated
vendored
|
@ -4,7 +4,7 @@ import (
|
||||||
"flag"
|
"flag"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/codegangsta/cli"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/codegangsta/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCommandDoNotIgnoreFlags(t *testing.T) {
|
func TestCommandDoNotIgnoreFlags(t *testing.T) {
|
||||||
|
|
2
Godeps/_workspace/src/github.com/codegangsta/cli/context_test.go
generated
vendored
2
Godeps/_workspace/src/github.com/codegangsta/cli/context_test.go
generated
vendored
|
@ -5,7 +5,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/codegangsta/cli"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/codegangsta/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNewContext(t *testing.T) {
|
func TestNewContext(t *testing.T) {
|
||||||
|
|
2
Godeps/_workspace/src/github.com/codegangsta/cli/flag_test.go
generated
vendored
2
Godeps/_workspace/src/github.com/codegangsta/cli/flag_test.go
generated
vendored
|
@ -7,7 +7,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/codegangsta/cli"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/codegangsta/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
var boolFlagTests = []struct {
|
var boolFlagTests = []struct {
|
||||||
|
|
2
Godeps/_workspace/src/github.com/gorilla/mux/mux.go
generated
vendored
2
Godeps/_workspace/src/github.com/gorilla/mux/mux.go
generated
vendored
|
@ -9,7 +9,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"path"
|
"path"
|
||||||
|
|
||||||
"github.com/gorilla/context"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/gorilla/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewRouter returns a new router instance.
|
// NewRouter returns a new router instance.
|
||||||
|
|
2
Godeps/_workspace/src/github.com/gorilla/mux/mux_test.go
generated
vendored
2
Godeps/_workspace/src/github.com/gorilla/mux/mux_test.go
generated
vendored
|
@ -9,7 +9,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/gorilla/context"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/gorilla/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
type routeTest struct {
|
type routeTest struct {
|
||||||
|
|
4
Godeps/_workspace/src/github.com/jmoiron/modl/dbmap.go
generated
vendored
4
Godeps/_workspace/src/github.com/jmoiron/modl/dbmap.go
generated
vendored
|
@ -18,8 +18,8 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/jmoiron/sqlx"
|
||||||
"github.com/jmoiron/sqlx/reflectx"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/jmoiron/sqlx/reflectx"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TableNameMapper is the function used by AddTable to map struct names to database table names, in analogy
|
// TableNameMapper is the function used by AddTable to map struct names to database table names, in analogy
|
||||||
|
|
2
Godeps/_workspace/src/github.com/jmoiron/modl/dialect.go
generated
vendored
2
Godeps/_workspace/src/github.com/jmoiron/modl/dialect.go
generated
vendored
|
@ -6,7 +6,7 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/jmoiron/sqlx"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Dialect is an interface that encapsulates behaviors that differ across
|
// Dialect is an interface that encapsulates behaviors that differ across
|
||||||
|
|
2
Godeps/_workspace/src/github.com/jmoiron/modl/handle.go
generated
vendored
2
Godeps/_workspace/src/github.com/jmoiron/modl/handle.go
generated
vendored
|
@ -3,7 +3,7 @@ package modl
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/jmoiron/sqlx"
|
||||||
)
|
)
|
||||||
|
|
||||||
// a cursor is either an sqlx.Db or an sqlx.Tx
|
// a cursor is either an sqlx.Db or an sqlx.Tx
|
||||||
|
|
2
Godeps/_workspace/src/github.com/jmoiron/modl/modl_test.go
generated
vendored
2
Godeps/_workspace/src/github.com/jmoiron/modl/modl_test.go
generated
vendored
|
@ -11,8 +11,8 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
_ "github.com/go-sql-driver/mysql"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
_ "github.com/lib/pq"
|
|
||||||
_ "github.com/mattn/go-sqlite3"
|
_ "github.com/mattn/go-sqlite3"
|
||||||
|
_ "github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/lib/pq"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = log.Fatal
|
var _ = log.Fatal
|
||||||
|
|
4
Godeps/_workspace/src/github.com/jmoiron/modl/tablemap.go
generated
vendored
4
Godeps/_workspace/src/github.com/jmoiron/modl/tablemap.go
generated
vendored
|
@ -5,8 +5,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/jmoiron/sqlx"
|
||||||
"github.com/jmoiron/sqlx/reflectx"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/jmoiron/sqlx/reflectx"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TableMap represents a mapping between a Go struct and a database table
|
// TableMap represents a mapping between a Go struct and a database table
|
||||||
|
|
2
Godeps/_workspace/src/github.com/jmoiron/modl/transaction.go
generated
vendored
2
Godeps/_workspace/src/github.com/jmoiron/modl/transaction.go
generated
vendored
|
@ -3,7 +3,7 @@ package modl
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/jmoiron/sqlx"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Transaction represents a database transaction.
|
// Transaction represents a database transaction.
|
||||||
|
|
2
Godeps/_workspace/src/github.com/jmoiron/sqlx/named.go
generated
vendored
2
Godeps/_workspace/src/github.com/jmoiron/sqlx/named.go
generated
vendored
|
@ -19,7 +19,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
|
||||||
"github.com/jmoiron/sqlx/reflectx"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/jmoiron/sqlx/reflectx"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NamedStmt is a prepared statement that executes named queries. Prepare it
|
// NamedStmt is a prepared statement that executes named queries. Prepare it
|
||||||
|
|
2
Godeps/_workspace/src/github.com/jmoiron/sqlx/sqlx.go
generated
vendored
2
Godeps/_workspace/src/github.com/jmoiron/sqlx/sqlx.go
generated
vendored
|
@ -11,7 +11,7 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/jmoiron/sqlx/reflectx"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/jmoiron/sqlx/reflectx"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Although the NameMapper is convenient, in practice it should not
|
// Although the NameMapper is convenient, in practice it should not
|
||||||
|
|
4
Godeps/_workspace/src/github.com/jmoiron/sqlx/sqlx_test.go
generated
vendored
4
Godeps/_workspace/src/github.com/jmoiron/sqlx/sqlx_test.go
generated
vendored
|
@ -23,9 +23,9 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
_ "github.com/go-sql-driver/mysql"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
"github.com/jmoiron/sqlx/reflectx"
|
|
||||||
_ "github.com/lib/pq"
|
|
||||||
_ "github.com/mattn/go-sqlite3"
|
_ "github.com/mattn/go-sqlite3"
|
||||||
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/jmoiron/sqlx/reflectx"
|
||||||
|
_ "github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/lib/pq"
|
||||||
)
|
)
|
||||||
|
|
||||||
/* compile time checks that Db, Tx, Stmt (qStmt) implement expected interfaces */
|
/* compile time checks that Db, Tx, Stmt (qStmt) implement expected interfaces */
|
||||||
|
|
2
Godeps/_workspace/src/github.com/lib/pq/bench_test.go
generated
vendored
2
Godeps/_workspace/src/github.com/lib/pq/bench_test.go
generated
vendored
|
@ -17,7 +17,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/lib/pq/oid"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/lib/pq/oid"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
2
Godeps/_workspace/src/github.com/lib/pq/buf.go
generated
vendored
2
Godeps/_workspace/src/github.com/lib/pq/buf.go
generated
vendored
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
|
||||||
"github.com/lib/pq/oid"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/lib/pq/oid"
|
||||||
)
|
)
|
||||||
|
|
||||||
type readBuf []byte
|
type readBuf []byte
|
||||||
|
|
2
Godeps/_workspace/src/github.com/lib/pq/conn.go
generated
vendored
2
Godeps/_workspace/src/github.com/lib/pq/conn.go
generated
vendored
|
@ -22,7 +22,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
|
||||||
"github.com/lib/pq/oid"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/lib/pq/oid"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Common error types
|
// Common error types
|
||||||
|
|
2
Godeps/_workspace/src/github.com/lib/pq/encode.go
generated
vendored
2
Godeps/_workspace/src/github.com/lib/pq/encode.go
generated
vendored
|
@ -11,7 +11,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/lib/pq/oid"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/lib/pq/oid"
|
||||||
)
|
)
|
||||||
|
|
||||||
func encode(parameterStatus *parameterStatus, x interface{}, pgtypOid oid.Oid) []byte {
|
func encode(parameterStatus *parameterStatus, x interface{}, pgtypOid oid.Oid) []byte {
|
||||||
|
|
2
Godeps/_workspace/src/github.com/lib/pq/encode_test.go
generated
vendored
2
Godeps/_workspace/src/github.com/lib/pq/encode_test.go
generated
vendored
|
@ -6,7 +6,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/lib/pq/oid"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/lib/pq/oid"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestScanTimestamp(t *testing.T) {
|
func TestScanTimestamp(t *testing.T) {
|
||||||
|
|
2
Godeps/_workspace/src/github.com/lib/pq/hstore/hstore_test.go
generated
vendored
2
Godeps/_workspace/src/github.com/lib/pq/hstore/hstore_test.go
generated
vendored
|
@ -5,7 +5,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
_ "github.com/lib/pq"
|
_ "github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/lib/pq"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Fatalistic interface {
|
type Fatalistic interface {
|
||||||
|
|
2
Godeps/_workspace/src/github.com/lib/pq/oid/gen.go
generated
vendored
2
Godeps/_workspace/src/github.com/lib/pq/oid/gen.go
generated
vendored
|
@ -11,7 +11,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
|
||||||
_ "github.com/lib/pq"
|
_ "github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/lib/pq"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/acceptance/bounces_test.go
generated
vendored
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/acceptance/bounces_test.go
generated
vendored
|
@ -4,7 +4,7 @@ package acceptance
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
mailgun "github.com/mailgun/mailgun-go"
|
mailgun "github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mailgun/mailgun-go"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/acceptance/credentials_test.go
generated
vendored
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/acceptance/credentials_test.go
generated
vendored
|
@ -4,7 +4,7 @@ package acceptance
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
mailgun "github.com/mailgun/mailgun-go"
|
mailgun "github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mailgun/mailgun-go"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
|
|
4
Godeps/_workspace/src/github.com/mailgun/mailgun-go/acceptance/domains_test.go
generated
vendored
4
Godeps/_workspace/src/github.com/mailgun/mailgun-go/acceptance/domains_test.go
generated
vendored
|
@ -5,7 +5,7 @@ package acceptance
|
||||||
import (
|
import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/mailgun/mailgun-go"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mailgun/mailgun-go"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ func TestGetSingleDomainNotExist(t *testing.T) {
|
||||||
domain := reqEnv(t, "MG_DOMAIN")
|
domain := reqEnv(t, "MG_DOMAIN")
|
||||||
apiKey := reqEnv(t, "MG_API_KEY")
|
apiKey := reqEnv(t, "MG_API_KEY")
|
||||||
mg := mailgun.NewMailgun(domain, apiKey, "")
|
mg := mailgun.NewMailgun(domain, apiKey, "")
|
||||||
_, _, _, err := mg.GetSingleDomain(randomString(32, "com.edu.org.")+".com")
|
_, _, _, err := mg.GetSingleDomain(randomString(32, "com.edu.org.") + ".com")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatal("Did not expect a domain to exist")
|
t.Fatal("Did not expect a domain to exist")
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
package acceptance
|
package acceptance
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/mailgun/mailgun-go"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mailgun/mailgun-go"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/acceptance/events_test.go
generated
vendored
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/acceptance/events_test.go
generated
vendored
|
@ -4,7 +4,7 @@ package acceptance
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/mailgun/mailgun-go"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mailgun/mailgun-go"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
|
|
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/acceptance/mailing_lists_test.go
generated
vendored
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/acceptance/mailing_lists_test.go
generated
vendored
|
@ -4,7 +4,7 @@ package acceptance
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
mailgun "github.com/mailgun/mailgun-go"
|
mailgun "github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mailgun/mailgun-go"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
8
Godeps/_workspace/src/github.com/mailgun/mailgun-go/acceptance/messages_test.go
generated
vendored
8
Godeps/_workspace/src/github.com/mailgun/mailgun-go/acceptance/messages_test.go
generated
vendored
|
@ -4,7 +4,7 @@ package acceptance
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
mailgun "github.com/mailgun/mailgun-go"
|
mailgun "github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mailgun/mailgun-go"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -169,7 +169,7 @@ func TestGetStoredMessage(t *testing.T) {
|
||||||
func findStoredMessageID(mg mailgun.Mailgun) (string, error) {
|
func findStoredMessageID(mg mailgun.Mailgun) (string, error) {
|
||||||
ei := mg.NewEventIterator()
|
ei := mg.NewEventIterator()
|
||||||
err := ei.GetFirstPage(mailgun.GetEventsOptions{})
|
err := ei.GetFirstPage(mailgun.GetEventsOptions{})
|
||||||
for{
|
for {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,7 @@ func TestSendMGBatchFailRecipients(t *testing.T) {
|
||||||
mg := mailgun.NewMailgun(domain, apiKey, "")
|
mg := mailgun.NewMailgun(domain, apiKey, "")
|
||||||
m := mg.NewMessage(fromUser, exampleSubject, exampleText+"Batch\n")
|
m := mg.NewMessage(fromUser, exampleSubject, exampleText+"Batch\n")
|
||||||
for i := 0; i < mailgun.MaxNumberOfRecipients; i++ {
|
for i := 0; i < mailgun.MaxNumberOfRecipients; i++ {
|
||||||
m.AddRecipient("") // We expect this to indicate a failure at the API
|
m.AddRecipient("") // We expect this to indicate a failure at the API
|
||||||
}
|
}
|
||||||
err := m.AddRecipientAndVariables(toUser, nil)
|
err := m.AddRecipientAndVariables(toUser, nil)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
@ -316,7 +316,7 @@ func TestSendMGBatchRecipientVariables(t *testing.T) {
|
||||||
mg := mailgun.NewMailgun(domain, apiKey, "")
|
mg := mailgun.NewMailgun(domain, apiKey, "")
|
||||||
m := mg.NewMessage(fromUser, exampleSubject, templateText)
|
m := mg.NewMessage(fromUser, exampleSubject, templateText)
|
||||||
err := m.AddRecipientAndVariables(toUser, map[string]interface{}{
|
err := m.AddRecipientAndVariables(toUser, map[string]interface{}{
|
||||||
"name": "Joe Cool Example",
|
"name": "Joe Cool Example",
|
||||||
"table": 42,
|
"table": 42,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/acceptance/routes_test.go
generated
vendored
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/acceptance/routes_test.go
generated
vendored
|
@ -3,7 +3,7 @@
|
||||||
package acceptance
|
package acceptance
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/mailgun/mailgun-go"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mailgun/mailgun-go"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
package acceptance
|
package acceptance
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/mailgun/mailgun-go"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mailgun/mailgun-go"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/acceptance/stats_test.go
generated
vendored
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/acceptance/stats_test.go
generated
vendored
|
@ -4,7 +4,7 @@ package acceptance
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
mailgun "github.com/mailgun/mailgun-go"
|
mailgun "github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mailgun/mailgun-go"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
|
|
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/acceptance/unsubscribes_test.go
generated
vendored
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/acceptance/unsubscribes_test.go
generated
vendored
|
@ -4,7 +4,7 @@ package acceptance
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
mailgun "github.com/mailgun/mailgun-go"
|
mailgun "github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mailgun/mailgun-go"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
|
|
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/acceptance/webhooks_test.go
generated
vendored
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/acceptance/webhooks_test.go
generated
vendored
|
@ -3,7 +3,7 @@
|
||||||
package acceptance
|
package acceptance
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/mailgun/mailgun-go"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mailgun/mailgun-go"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/bounces.go
generated
vendored
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/bounces.go
generated
vendored
|
@ -1,7 +1,7 @@
|
||||||
package mailgun
|
package mailgun
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/mbanzon/simplehttp"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mbanzon/simplehttp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/campaigns.go
generated
vendored
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/campaigns.go
generated
vendored
|
@ -1,7 +1,7 @@
|
||||||
package mailgun
|
package mailgun
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/mbanzon/simplehttp"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mbanzon/simplehttp"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Campaigns have been deprecated since development work on this SDK commenced.
|
// Campaigns have been deprecated since development work on this SDK commenced.
|
||||||
|
|
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/credentials.go
generated
vendored
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/credentials.go
generated
vendored
|
@ -2,7 +2,7 @@ package mailgun
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/mbanzon/simplehttp"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mbanzon/simplehttp"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/domains.go
generated
vendored
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/domains.go
generated
vendored
|
@ -1,7 +1,7 @@
|
||||||
package mailgun
|
package mailgun
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/mbanzon/simplehttp"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mbanzon/simplehttp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/email_validation.go
generated
vendored
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/email_validation.go
generated
vendored
|
@ -1,7 +1,7 @@
|
||||||
package mailgun
|
package mailgun
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/mbanzon/simplehttp"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mbanzon/simplehttp"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/events.go
generated
vendored
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/events.go
generated
vendored
|
@ -2,7 +2,7 @@ package mailgun
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/mbanzon/simplehttp"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mbanzon/simplehttp"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/mailgun.go
generated
vendored
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/mailgun.go
generated
vendored
|
@ -94,7 +94,7 @@ package mailgun
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/mbanzon/simplehttp"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mbanzon/simplehttp"
|
||||||
"io"
|
"io"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/mailing_lists.go
generated
vendored
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/mailing_lists.go
generated
vendored
|
@ -3,7 +3,7 @@ package mailgun
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/mbanzon/simplehttp"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mbanzon/simplehttp"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/messages.go
generated
vendored
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/messages.go
generated
vendored
|
@ -6,7 +6,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/mbanzon/simplehttp"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mbanzon/simplehttp"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MaxNumberOfRecipients represents the largest batch of recipients that Mailgun can support in a single API call.
|
// MaxNumberOfRecipients represents the largest batch of recipients that Mailgun can support in a single API call.
|
||||||
|
|
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/rest_shim.go
generated
vendored
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/rest_shim.go
generated
vendored
|
@ -2,7 +2,7 @@ package mailgun
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/mbanzon/simplehttp"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mbanzon/simplehttp"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The MailgunGoUserAgent identifies the client to the server, for logging purposes.
|
// The MailgunGoUserAgent identifies the client to the server, for logging purposes.
|
||||||
|
|
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/routes.go
generated
vendored
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/routes.go
generated
vendored
|
@ -1,7 +1,7 @@
|
||||||
package mailgun
|
package mailgun
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/mbanzon/simplehttp"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mbanzon/simplehttp"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/spam_complaints.go
generated
vendored
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/spam_complaints.go
generated
vendored
|
@ -1,7 +1,7 @@
|
||||||
package mailgun
|
package mailgun
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/mbanzon/simplehttp"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mbanzon/simplehttp"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/stats.go
generated
vendored
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/stats.go
generated
vendored
|
@ -1,7 +1,7 @@
|
||||||
package mailgun
|
package mailgun
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/mbanzon/simplehttp"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mbanzon/simplehttp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/unsubscribes.go
generated
vendored
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/unsubscribes.go
generated
vendored
|
@ -1,7 +1,7 @@
|
||||||
package mailgun
|
package mailgun
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/mbanzon/simplehttp"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mbanzon/simplehttp"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/webhooks.go
generated
vendored
2
Godeps/_workspace/src/github.com/mailgun/mailgun-go/webhooks.go
generated
vendored
|
@ -1,7 +1,7 @@
|
||||||
package mailgun
|
package mailgun
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/mbanzon/simplehttp"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mbanzon/simplehttp"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetWebhooks returns the complete set of webhooks configured for your domain.
|
// GetWebhooks returns the complete set of webhooks configured for your domain.
|
||||||
|
|
13
Godeps/_workspace/src/github.com/nytimes/gziphandler/LICENSE.md
generated
vendored
Normal file
13
Godeps/_workspace/src/github.com/nytimes/gziphandler/LICENSE.md
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
Copyright (c) 2015 The New York Times Company
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this library except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
52
Godeps/_workspace/src/github.com/nytimes/gziphandler/README.md
generated
vendored
Normal file
52
Godeps/_workspace/src/github.com/nytimes/gziphandler/README.md
generated
vendored
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
Gzip Handler
|
||||||
|
============
|
||||||
|
|
||||||
|
This is a tiny Go package which wraps HTTP handlers to transparently gzip the
|
||||||
|
response body, for clients which support it. Although it's usually simpler to
|
||||||
|
leave that to a reverse proxy (like nginx or Varnish), this package is useful
|
||||||
|
when that's undesirable.
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Call `GzipHandler` with any handler (an object which implements the
|
||||||
|
`http.Handler` interface), and it'll return a new handler which gzips the
|
||||||
|
response. For example:
|
||||||
|
|
||||||
|
```go
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
"github.com/nytimes/gziphandler"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
withoutGz := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.Header().Set("Content-Type", "text/plain")
|
||||||
|
io.WriteString(w, "Hello, World")
|
||||||
|
})
|
||||||
|
|
||||||
|
withGz := gziphandler.GzipHandler(withoutGz)
|
||||||
|
|
||||||
|
http.Handle("/", withGz)
|
||||||
|
http.ListenAndServe("0.0.0.0:8000", nil)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
The docs can be found at [godoc.org] [docs], as usual.
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[Apache 2.0] [license].
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[docs]: https://godoc.org/github.com/nytimes/gziphandler
|
||||||
|
[license]: https://github.com/nytimes/gziphandler/blob/master/LICENSE.md
|
118
Godeps/_workspace/src/github.com/nytimes/gziphandler/gzip.go
generated
vendored
Normal file
118
Godeps/_workspace/src/github.com/nytimes/gziphandler/gzip.go
generated
vendored
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
package gziphandler
|
||||||
|
|
||||||
|
import (
|
||||||
|
"compress/gzip"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
type codings map[string]float64
|
||||||
|
|
||||||
|
// The default qvalue to assign to an encoding if no explicit qvalue is set.
|
||||||
|
// This is actually kind of ambiguous in RFC 2616, so hopefully it's correct.
|
||||||
|
// The examples seem to indicate that it is.
|
||||||
|
const DEFAULT_QVALUE = 1.0
|
||||||
|
|
||||||
|
// GzipResponseWriter provides an http.ResponseWriter interface, which gzips
|
||||||
|
// bytes before writing them to the underlying response. This doesn't set the
|
||||||
|
// Content-Encoding header, nor close the writers, so don't forget to do that.
|
||||||
|
type GzipResponseWriter struct {
|
||||||
|
io.Writer
|
||||||
|
http.ResponseWriter
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write appends data to the gzip writer.
|
||||||
|
func (gzw GzipResponseWriter) Write(b []byte) (int, error) {
|
||||||
|
return gzw.Writer.Write(b)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GzipHandler wraps an HTTP handler, to transparently gzip the response body if
|
||||||
|
// the client supports it (via the Accept-Encoding header).
|
||||||
|
func GzipHandler(h http.Handler) http.Handler {
|
||||||
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
if acceptsGzip(r) {
|
||||||
|
|
||||||
|
// Bytes written during ServeHTTP are redirected to this gzip writer
|
||||||
|
// before being written to the underlying response.
|
||||||
|
gzw := gzip.NewWriter(w)
|
||||||
|
defer gzw.Close()
|
||||||
|
|
||||||
|
w.Header().Set("Content-Encoding", "gzip")
|
||||||
|
h.ServeHTTP(GzipResponseWriter{gzw, w}, r)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
h.ServeHTTP(w, r)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// acceptsGzip returns true if the given HTTP request indicates that it will
|
||||||
|
// accept a gzippped response.
|
||||||
|
func acceptsGzip(r *http.Request) bool {
|
||||||
|
acceptedEncodings, _ := parseEncodings(r.Header.Get("Accept-Encoding"))
|
||||||
|
return acceptedEncodings["gzip"] > 0.0
|
||||||
|
}
|
||||||
|
|
||||||
|
// parseEncodings attempts to parse a list of codings, per RFC 2616, as might
|
||||||
|
// appear in an Accept-Encoding header. It returns a map of content-codings to
|
||||||
|
// quality values, and an error containing the errors encounted. It's probably
|
||||||
|
// safe to ignore those, because silently ignoring errors is how the internet
|
||||||
|
// works.
|
||||||
|
//
|
||||||
|
// See: http://tools.ietf.org/html/rfc2616#section-14.3
|
||||||
|
func parseEncodings(s string) (codings, error) {
|
||||||
|
c := make(codings)
|
||||||
|
e := make([]string, 0)
|
||||||
|
|
||||||
|
for _, ss := range strings.Split(s, ",") {
|
||||||
|
coding, qvalue, err := parseCoding(ss)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
e = append(e, err.Error())
|
||||||
|
|
||||||
|
} else {
|
||||||
|
c[coding] = qvalue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO (adammck): Use a proper multi-error struct, so the individual errors
|
||||||
|
// can be extracted if anyone cares.
|
||||||
|
if len(e) > 0 {
|
||||||
|
return c, fmt.Errorf("errors while parsing encodings: %s", strings.Join(e, ", "))
|
||||||
|
}
|
||||||
|
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// parseCoding parses a single conding (content-coding with an optional qvalue),
|
||||||
|
// as might appear in an Accept-Encoding header. It attempts to forgive minor
|
||||||
|
// formatting errors.
|
||||||
|
func parseCoding(s string) (coding string, qvalue float64, err error) {
|
||||||
|
for n, part := range strings.Split(s, ";") {
|
||||||
|
part = strings.TrimSpace(part)
|
||||||
|
qvalue = DEFAULT_QVALUE
|
||||||
|
|
||||||
|
if n == 0 {
|
||||||
|
coding = strings.ToLower(part)
|
||||||
|
|
||||||
|
} else if strings.HasPrefix(part, "q=") {
|
||||||
|
qvalue, err = strconv.ParseFloat(strings.TrimPrefix(part, "q="), 64)
|
||||||
|
|
||||||
|
if qvalue < 0.0 {
|
||||||
|
qvalue = 0.0
|
||||||
|
|
||||||
|
} else if qvalue > 1.0 {
|
||||||
|
qvalue = 1.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if coding == "" {
|
||||||
|
err = fmt.Errorf("empty content-coding")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
72
Godeps/_workspace/src/github.com/nytimes/gziphandler/gzip_test.go
generated
vendored
Normal file
72
Godeps/_workspace/src/github.com/nytimes/gziphandler/gzip_test.go
generated
vendored
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
package gziphandler
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"compress/gzip"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
"net/http/httptest"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestParseEncodings(t *testing.T) {
|
||||||
|
|
||||||
|
examples := map[string]codings{
|
||||||
|
|
||||||
|
// Examples from RFC 2616
|
||||||
|
"compress, gzip": codings{"compress": 1.0, "gzip": 1.0},
|
||||||
|
"": codings{},
|
||||||
|
"*": codings{"*": 1.0},
|
||||||
|
"compress;q=0.5, gzip;q=1.0": codings{"compress": 0.5, "gzip": 1.0},
|
||||||
|
"gzip;q=1.0, identity; q=0.5, *;q=0": codings{"gzip": 1.0, "identity": 0.5, "*": 0.0},
|
||||||
|
|
||||||
|
// More random stuff
|
||||||
|
"AAA;q=1": codings{"aaa": 1.0},
|
||||||
|
"BBB ; q = 2": codings{"bbb": 1.0},
|
||||||
|
}
|
||||||
|
|
||||||
|
for eg, exp := range examples {
|
||||||
|
act, _ := parseEncodings(eg)
|
||||||
|
assert.Equal(t, exp, act)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGzipHandler(t *testing.T) {
|
||||||
|
testBody := "aaabbbccc"
|
||||||
|
|
||||||
|
// This just exists to provide something for GzipHandler to wrap.
|
||||||
|
handler := GzipHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.Header().Set("Content-Type", "text/plain")
|
||||||
|
io.WriteString(w, testBody)
|
||||||
|
}))
|
||||||
|
|
||||||
|
// requests without accept-encoding are passed along as-is
|
||||||
|
|
||||||
|
req1, _ := http.NewRequest("GET", "/whatever", nil)
|
||||||
|
res1 := httptest.NewRecorder()
|
||||||
|
handler.ServeHTTP(res1, req1)
|
||||||
|
|
||||||
|
assert.Equal(t, 200, res1.Code)
|
||||||
|
assert.Equal(t, "", res1.Header().Get("Content-Encoding"))
|
||||||
|
assert.Equal(t, testBody, res1.Body.String())
|
||||||
|
|
||||||
|
// but requests with accept-encoding:gzip are compressed if possible
|
||||||
|
|
||||||
|
req2, _ := http.NewRequest("GET", "/whatever", nil)
|
||||||
|
req2.Header.Set("Accept-Encoding", "gzip")
|
||||||
|
res2 := httptest.NewRecorder()
|
||||||
|
handler.ServeHTTP(res2, req2)
|
||||||
|
|
||||||
|
assert.Equal(t, 200, res2.Code)
|
||||||
|
assert.Equal(t, "gzip", res2.Header().Get("Content-Encoding"))
|
||||||
|
assert.Equal(t, gzipStr(testBody), res2.Body.Bytes())
|
||||||
|
}
|
||||||
|
|
||||||
|
func gzipStr(s string) []byte {
|
||||||
|
var b bytes.Buffer
|
||||||
|
w := gzip.NewWriter(&b)
|
||||||
|
io.WriteString(w, s)
|
||||||
|
w.Close()
|
||||||
|
return b.Bytes()
|
||||||
|
}
|
2
Godeps/_workspace/src/github.com/thermokarst/jwt/examples/net-http.go
generated
vendored
2
Godeps/_workspace/src/github.com/thermokarst/jwt/examples/net-http.go
generated
vendored
|
@ -7,7 +7,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/thermokarst/jwt"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/thermokarst/jwt"
|
||||||
)
|
)
|
||||||
|
|
||||||
func protectMe(w http.ResponseWriter, r *http.Request) {
|
func protectMe(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
2
Godeps/_workspace/src/golang.org/x/crypto/bcrypt/bcrypt.go
generated
vendored
2
Godeps/_workspace/src/golang.org/x/crypto/bcrypt/bcrypt.go
generated
vendored
|
@ -12,7 +12,7 @@ import (
|
||||||
"crypto/subtle"
|
"crypto/subtle"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"golang.org/x/crypto/blowfish"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/golang.org/x/crypto/blowfish"
|
||||||
"io"
|
"io"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/jmoiron/modl"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/jmoiron/modl"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/gorilla/mux"
|
||||||
)
|
)
|
||||||
|
|
||||||
func handleCompare(w http.ResponseWriter, r *http.Request) *appError {
|
func handleCompare(w http.ResponseWriter, r *http.Request) *appError {
|
||||||
|
|
|
@ -12,9 +12,10 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gorilla/context"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/gorilla/context"
|
||||||
"github.com/gorilla/mux"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/gorilla/mux"
|
||||||
"github.com/thermokarst/jwt"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/nytimes/gziphandler"
|
||||||
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/thermokarst/jwt"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -125,7 +126,7 @@ func Handler() http.Handler {
|
||||||
s.Handle(route.p, j.Secure(errorHandler(route.f), verifyClaims)).Methods(route.m)
|
s.Handle(route.p, j.Secure(errorHandler(route.f), verifyClaims)).Methods(route.m)
|
||||||
}
|
}
|
||||||
|
|
||||||
return jsonHandler(corsHandler(m))
|
return jsonHandler(gziphandler.GzipHandler(corsHandler(m)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleGetter(g getter) errorHandler {
|
func handleGetter(g getter) errorHandler {
|
||||||
|
|
|
@ -8,8 +8,8 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gorilla/context"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/gorilla/context"
|
||||||
"github.com/lib/pq"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/lib/pq"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
14
main.go
14
main.go
|
@ -8,13 +8,13 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/DavidHuie/gomigrate"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/DavidHuie/gomigrate"
|
||||||
"github.com/codegangsta/cli"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/codegangsta/cli"
|
||||||
"github.com/gorilla/schema"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/gorilla/schema"
|
||||||
"github.com/jmoiron/modl"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/jmoiron/modl"
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/jmoiron/sqlx"
|
||||||
"github.com/lib/pq"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/lib/pq"
|
||||||
"github.com/mailgun/mailgun-go"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mailgun/mailgun-go"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/jmoiron/modl"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/jmoiron/modl"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/jmoiron/modl"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/jmoiron/modl"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/jmoiron/modl"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/jmoiron/modl"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
2
types.go
2
types.go
|
@ -9,7 +9,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/lib/pq"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/lib/pq"
|
||||||
)
|
)
|
||||||
|
|
||||||
type NullBool struct {
|
type NullBool struct {
|
||||||
|
|
9
users.go
9
users.go
|
@ -10,11 +10,10 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/gorilla/mux"
|
||||||
"github.com/lib/pq"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/lib/pq"
|
||||||
"github.com/mailgun/mailgun-go"
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/github.com/mailgun/mailgun-go"
|
||||||
|
"github.com/thermokarst/bactdb/Godeps/_workspace/src/golang.org/x/crypto/bcrypt"
|
||||||
"golang.org/x/crypto/bcrypt"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
Reference in a new issue