code: func (b BitbucketHook) Handle(w http.ResponseWriter, r *http.Request, repo *Repo) (int, error) {
  	if !b.verifyBitbucketIP(r.RemoteAddr) {
  		return http.StatusForbidden, errors.New("the request doesn't come from a valid IP")
  	}
  
  	if r.Method != "POST" {
  		return http.StatusMethodNotAllowed, errors.New("the request had an invalid method")
  	}
  
  	body, err := ioutil.ReadAll(r.Body)
  	if err != nil {
  		return http.StatusRequestTimeout, errors.New("could not read body from request")
  	}
  
  	event := r.Header.Get("X-Event-Key")
  	if event == "" {
  		return http.StatusBadRequest, errors.New("the 'X-Event-Key' header is required but was missing")
  	}
  
  	switch event {
  	case "repo:push":
  		err = b.handlePush(body, repo)
  		if !hookIgnored(err) && err != nil {
  			return http.StatusBadRequest, err
  		}
  	default:
  		// return 400 if we do not handle the event type.
  		return http.StatusBadRequest, nil
  	}
  
  	return http.StatusOK, err
  }
docs: // Handle satisfies hookHandler.