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

hazendaz / httpunit / 656

06 Dec 2025 09:11PM UTC coverage: 80.452% (+0.02%) from 80.435%
656

push

github

hazendaz
[maven-release-plugin] prepare for next development iteration

3213 of 4105 branches covered (78.27%)

Branch coverage included in aggregate %.

8245 of 10137 relevant lines covered (81.34%)

0.81 hits per line

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

92.31
/src/main/java/com/meterware/httpunit/HeaderOnlyWebRequest.java
1
/*
2
 * MIT License
3
 *
4
 * Copyright 2011-2025 Russell Gold
5
 *
6
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
7
 * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
8
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
9
 * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10
 *
11
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions
12
 * of the Software.
13
 *
14
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
15
 * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
17
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18
 * DEALINGS IN THE SOFTWARE.
19
 */
20
package com.meterware.httpunit;
21

22
import com.meterware.httpunit.protocol.URLEncodedString;
23

24
import java.io.IOException;
25
import java.net.URL;
26

27
import org.w3c.dom.Element;
28

29
/**
30
 * A web request which has no information in its message body.
31
 **/
32
public class HeaderOnlyWebRequest extends WebRequest {
33

34
    /**
35
     * Returns the query string defined for this request.
36
     **/
37
    @Override
38
    public String getQueryString() {
39
        try {
40
            URLEncodedString encoder = new URLEncodedString();
1✔
41
            getParameterHolder().recordPredefinedParameters(encoder);
1✔
42
            getParameterHolder().recordParameters(encoder);
1✔
43
            return encoder.getString();
1✔
44
        } catch (IOException e) {
×
45
            throw new RuntimeException("Programming error: " + e); // should never happen
×
46
        }
47
    }
48

49
    /**
50
     * Sets the method.
51
     *
52
     * @param method
53
     *            the method to set
54
     */
55
    public void setMethod(String method) {
56
        this.method = method;
1✔
57
    }
1✔
58

59
    // -------------------------------- protected members ---------------------------
60

61
    /**
62
     * Instantiates a new header only web request.
63
     *
64
     * @param urlBase
65
     *            the url base
66
     * @param urlString
67
     *            the url string
68
     * @param frame
69
     *            the frame
70
     * @param target
71
     *            the target
72
     */
73
    protected HeaderOnlyWebRequest(URL urlBase, String urlString, FrameSelector frame, String target) {
74
        super(urlBase, urlString, frame, target);
1✔
75
    }
1✔
76

77
    /**
78
     * Instantiates a new header only web request.
79
     *
80
     * @param urlBase
81
     *            the url base
82
     * @param urlString
83
     *            the url string
84
     * @param target
85
     *            the target
86
     */
87
    protected HeaderOnlyWebRequest(URL urlBase, String urlString, String target) {
88
        super(urlBase, urlString, target);
1✔
89
    }
1✔
90

91
    /**
92
     * Instantiates a new header only web request.
93
     *
94
     * @param referer
95
     *            the referer
96
     * @param sourceElement
97
     *            the source element
98
     * @param urlBase
99
     *            the url base
100
     * @param urlString
101
     *            the url string
102
     * @param target
103
     *            the target
104
     */
105
    protected HeaderOnlyWebRequest(WebResponse referer, Element sourceElement, URL urlBase, String urlString,
106
            String target) {
107
        super(referer, sourceElement, urlBase, urlString, target);
1✔
108
    }
1✔
109

110
    /**
111
     * Instantiates a new header only web request.
112
     *
113
     * @param urlBase
114
     *            the url base
115
     * @param urlString
116
     *            the url string
117
     */
118
    protected HeaderOnlyWebRequest(URL urlBase, String urlString) {
119
        super(urlBase, urlString);
1✔
120
    }
1✔
121

122
    /**
123
     * Instantiates a new header only web request.
124
     *
125
     * @param urlString
126
     *            the url string
127
     */
128
    protected HeaderOnlyWebRequest(String urlString) {
129
        super(urlString);
1✔
130
    }
1✔
131

132
    // ------------------------------------ package members --------------------------
133

134
    /**
135
     * Instantiates a new header only web request.
136
     *
137
     * @param requestSource
138
     *            the request source
139
     */
140
    HeaderOnlyWebRequest(WebRequestSource requestSource) {
141
        super(requestSource, WebRequest.newParameterHolder(requestSource));
1✔
142
        setHeaderField(REFERER_HEADER_NAME, requestSource.getBaseURL().toExternalForm());
1✔
143
    }
1✔
144

145
    /**
146
     * Instantiates a new header only web request.
147
     *
148
     * @param sourceForm
149
     *            the source form
150
     * @param parameterHolder
151
     *            the parameter holder
152
     * @param button
153
     *            the button
154
     * @param x
155
     *            the x
156
     * @param y
157
     *            the y
158
     */
159
    HeaderOnlyWebRequest(WebForm sourceForm, ParameterHolder parameterHolder, SubmitButton button, int x, int y) {
160
        super(sourceForm, parameterHolder, button, x, y);
1✔
161
        setHeaderField(REFERER_HEADER_NAME, sourceForm.getBaseURL().toExternalForm());
1✔
162
    }
1✔
163

164
    /**
165
     * Instantiates a new header only web request.
166
     *
167
     * @param urlBase
168
     *            the url base
169
     * @param urlString
170
     *            the url string
171
     * @param frame
172
     *            the frame
173
     */
174
    HeaderOnlyWebRequest(URL urlBase, String urlString, FrameSelector frame) {
175
        super(urlBase, urlString, frame, frame.getName());
1✔
176
    }
1✔
177

178
}
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