package chuper

import (
	"net/url"

	"github.com/PuerkitoBio/fetchbot"
	"github.com/Sirupsen/logrus"
)

type Context interface {
	Cache() Cache
	Queue() Enqueuer
	Log(fields map[string]interface{}) *logrus.Entry
	URL() *url.URL
	Method() string
	SourceURL() *url.URL
}

type Ctx struct {
	*fetchbot.Context
	C Cache
	L *logrus.Logger
}

func (c *Ctx) Cache() Cache {
	return c.C
}

func (c *Ctx) Queue() Enqueuer {
	return &Queue{c.Q}
}

func (c *Ctx) Log(fields map[string]interface{}) *logrus.Entry {
	data := logrus.Fields{}
	for k, v := range fields {
		data[k] = v
	}
	return c.L.WithFields(data)
}

func (c *Ctx) URL() *url.URL {
	return c.Cmd.URL()
}

func (c *Ctx) Method() string {
	return c.Cmd.Method()
}

func (c *Ctx) SourceURL() *url.URL {
	switch cmd := c.Cmd.(type) {
	case *Cmd:
		return cmd.SourceURL()
	case *CmdBasicAuth:
		return cmd.SourceURL()
	default:
		return nil
	}
}

package chuper

import (
	"net/url"

	"github.com/PuerkitoBio/fetchbot"
	"github.com/Sirupsen/logrus"
)

type Context interface {
	Cache() Cache
	Queue() Enqueuer
	Log(fields map[string]interface{}) *logrus.Entry
	URL() *url.URL
	SourceURL() *url.URL
}

type Ctx struct {
	*fetchbot.Context
	C Cache
	L *logrus.Logger
}

func (c *Ctx) Cache() Cache {
	return c.C
}

func (c *Ctx) Queue() Enqueuer {
	return &Queue{c.Q}
}

func (c *Ctx) Log(fields map[string]interface{}) *logrus.Entry {
	data := logrus.Fields{}
	for k, v := range fields {
		data[k] = v
	}
	return c.L.WithFields(data)
}

func (c *Ctx) URL() *url.URL {
	return c.Cmd.URL()
}

func (c *Ctx) SourceURL() *url.URL {
	switch cmd := c.Cmd.(type) {
	case *Cmd:
		return cmd.SourceURL()
	case *CmdBasicAuth:
		return cmd.SourceURL()
	default:
		return nil
	}
}

--- 
+++ 
@@ -12,6 +12,7 @@
 	Queue() Enqueuer
 	Log(fields map[string]interface{}) *logrus.Entry
 	URL() *url.URL
+	Method() string
 	SourceURL() *url.URL
 }
 
@@ -41,6 +42,10 @@
 	return c.Cmd.URL()
 }
 
+func (c *Ctx) Method() string {
+	return c.Cmd.Method()
+}
+
 func (c *Ctx) SourceURL() *url.URL {
 	switch cmd := c.Cmd.(type) {
 	case *Cmd:
Add Method to Context interface
