package com.atlassian.bitbucket.test.rest;

import net.sf.json.JSONObject;

import javax.annotation.Nonnull;

/**
 * Provides a common abstraction that can be shared by {@link RestRequest}s which have bodies. Bodies are only processed
 * on {@code POST} and {@code PUT} requests; if a request with a body is passed to a {@code DELETE} or a {@code GET} it
 * will be <i>ignored</i>.
 */
public interface HasBody {

    /**
     * Retrieves the body for the request. The body may be empty (no fields set on the {@code JSONObject}), but it may
     * not be {@code null}.
     *
     * @return the request's body, as JSON
     */
    @Nonnull
    JSONObject getBody();
}
