• 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

92.31
/src/main/java/com/meterware/httpunit/HeaderOnlyWebRequest.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 com.meterware.httpunit.protocol.URLEncodedString;
11

12
import java.io.IOException;
13
import java.net.URL;
14

15
import org.w3c.dom.Element;
16

17
/**
18
 * A web request which has no information in its message body.
19
 **/
20
public class HeaderOnlyWebRequest extends WebRequest {
21

22
    /**
23
     * Returns the query string defined for this request.
24
     **/
25
    @Override
26
    public String getQueryString() {
27
        try {
28
            URLEncodedString encoder = new URLEncodedString();
1✔
29
            getParameterHolder().recordPredefinedParameters(encoder);
1✔
30
            getParameterHolder().recordParameters(encoder);
1✔
31
            return encoder.getString();
1✔
32
        } catch (IOException e) {
×
33
            throw new RuntimeException("Programming error: " + e); // should never happen
×
34
        }
35
    }
36

37
    /**
38
     * Sets the method.
39
     *
40
     * @param method
41
     *            the method to set
42
     */
43
    public void setMethod(String method) {
44
        this.method = method;
1✔
45
    }
1✔
46

47
    // -------------------------------- protected members ---------------------------
48

49
    /**
50
     * Instantiates a new header only web request.
51
     *
52
     * @param urlBase
53
     *            the url base
54
     * @param urlString
55
     *            the url string
56
     * @param frame
57
     *            the frame
58
     * @param target
59
     *            the target
60
     */
61
    protected HeaderOnlyWebRequest(URL urlBase, String urlString, FrameSelector frame, String target) {
62
        super(urlBase, urlString, frame, target);
1✔
63
    }
1✔
64

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

79
    /**
80
     * Instantiates a new header only web request.
81
     *
82
     * @param referer
83
     *            the referer
84
     * @param sourceElement
85
     *            the source element
86
     * @param urlBase
87
     *            the url base
88
     * @param urlString
89
     *            the url string
90
     * @param target
91
     *            the target
92
     */
93
    protected HeaderOnlyWebRequest(WebResponse referer, Element sourceElement, URL urlBase, String urlString,
94
            String target) {
95
        super(referer, sourceElement, urlBase, urlString, target);
1✔
96
    }
1✔
97

98
    /**
99
     * Instantiates a new header only web request.
100
     *
101
     * @param urlBase
102
     *            the url base
103
     * @param urlString
104
     *            the url string
105
     */
106
    protected HeaderOnlyWebRequest(URL urlBase, String urlString) {
107
        super(urlBase, urlString);
1✔
108
    }
1✔
109

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

120
    // ------------------------------------ package members --------------------------
121

122
    /**
123
     * Instantiates a new header only web request.
124
     *
125
     * @param requestSource
126
     *            the request source
127
     */
128
    HeaderOnlyWebRequest(WebRequestSource requestSource) {
129
        super(requestSource, WebRequest.newParameterHolder(requestSource));
1✔
130
        setHeaderField(REFERER_HEADER_NAME, requestSource.getBaseURL().toExternalForm());
1✔
131
    }
1✔
132

133
    /**
134
     * Instantiates a new header only web request.
135
     *
136
     * @param sourceForm
137
     *            the source form
138
     * @param parameterHolder
139
     *            the parameter holder
140
     * @param button
141
     *            the button
142
     * @param x
143
     *            the x
144
     * @param y
145
     *            the y
146
     */
147
    HeaderOnlyWebRequest(WebForm sourceForm, ParameterHolder parameterHolder, SubmitButton button, int x, int y) {
148
        super(sourceForm, parameterHolder, button, x, y);
1✔
149
        setHeaderField(REFERER_HEADER_NAME, sourceForm.getBaseURL().toExternalForm());
1✔
150
    }
1✔
151

152
    /**
153
     * Instantiates a new header only web request.
154
     *
155
     * @param urlBase
156
     *            the url base
157
     * @param urlString
158
     *            the url string
159
     * @param frame
160
     *            the frame
161
     */
162
    HeaderOnlyWebRequest(URL urlBase, String urlString, FrameSelector frame) {
163
        super(urlBase, urlString, frame, frame.getName());
1✔
164
    }
1✔
165

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