• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hazendaz / httpunit / 755

14 Feb 2026 07:14PM UTC coverage: 80.526%. Remained the same
755

push

github

hazendaz
[ci] Fix badge

3213 of 4105 branches covered (78.27%)

Branch coverage included in aggregate %.

8245 of 10124 relevant lines covered (81.44%)

0.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/com/meterware/httpunit/OptionsMethodWebRequest.java
1
/*
2
 * SPDX-License-Identifier: MIT
3
 * See LICENSE file for details.
4
 *
5
 * Copyright 2000-2026 Russell Gold
6
 * Copyright 2021-2000 hazendaz
7
 */
8
package com.meterware.httpunit;
9

10
import java.net.URL;
11

12
/**
13
 * A {@link WebRequest} using the OPTIONS method.
14
 * <p>
15
 * RFC 2616 section 9.2 defines:
16
 * <p>
17
 * The OPTIONS method represents a request for information about the communication options available on the
18
 * request/response chain identified by the Request-URI. This method allows the client to determine the options and/or
19
 * requirements associated with a resource, or the capabilities of a server, without implying a resource action or
20
 * initiating a resource retrieval.
21
 * <p>
22
 * Responses to this method are not cacheable.
23
 * <p>
24
 * If the OPTIONS request includes an entity-body (as indicated by the presence of Content-Length or Transfer-Encoding),
25
 * then the media type MUST be indicated by a Content-Type field. Although this specification does not define any use
26
 * for such a body, future extensions to HTTP might use the OPTIONS body to make more detailed queries on the server. A
27
 * server that does not support such an extension MAY discard the request body.
28
 * <p>
29
 * If the Request-URI is an asterisk ("*"), the OPTIONS request is intended to apply to the server in general rather
30
 * than to a specific resource. Since a server's communication options typically depend on the resource, the "*" request
31
 * is only useful as a "ping" or "no-op" type of method; it does nothing beyond allowing the client to test the
32
 * capabilities of the server. For example, this can be used to test a proxy for HTTP/1.1 compliance (or lack thereof).
33
 * <p>
34
 * If the Request-URI is not an asterisk, the OPTIONS request applies only to the options that are available when
35
 * communicating with that resource.
36
 * <p>
37
 * A 200 response SHOULD include any header fields that indicate optional features implemented by the server and
38
 * applicable to that resource (e.g., Allow), possibly including extensions not defined by this specification. The
39
 * response body, if any, SHOULD also include information about the communication options. The format for such a
40
 * <p>
41
 * body is not defined by this specification, but might be defined by future extensions to HTTP. Content negotiation MAY
42
 * be used to select the appropriate response format. If no response body is included, the response MUST include a
43
 * Content-Length field with a field-value of "0".
44
 * <p>
45
 * The Max-Forwards request-header field MAY be used to target a specific proxy in the request chain. When a proxy
46
 * receives an OPTIONS request on an absoluteURI for which request forwarding is permitted, the proxy MUST check for a
47
 * Max-Forwards field. If the Max-Forwards field-value is zero ("0"), the proxy MUST NOT forward the message; instead,
48
 * the proxy SHOULD respond with its own communication options. If the Max-Forwards field-value is an integer greater
49
 * than zero, the proxy MUST decrement the field-value when it forwards the request. If no Max-Forwards field is present
50
 * in the request, then the forwarded request MUST NOT include a Max-Forwards field.
51
 *
52
 * @see <a href="https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html">RFC-2616 Section 9</a>
53
 */
54
public class OptionsMethodWebRequest extends HeaderOnlyWebRequest {
55

56
    /**
57
     * initialize me - set method to OPTIONS.
58
     */
59
    private void init() {
60
        setMethod("OPTIONS");
×
61
    }
×
62

63
    /**
64
     * Creates a new options request from a complete URL string.
65
     *
66
     * @param urlString
67
     *            the URL desired, including the protocol.
68
     */
69
    public OptionsMethodWebRequest(String urlString) {
70
        super(urlString);
×
71
        init();
×
72
    }
×
73

74
    /**
75
     * Creates a new options request using a relative URL and base.
76
     *
77
     * @param urlBase
78
     *            the base URL.
79
     * @param urlString
80
     *            the relative URL
81
     */
82
    public OptionsMethodWebRequest(URL urlBase, String urlString) {
83
        super(urlBase, urlString);
×
84
        init();
×
85
    }
×
86
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc