Skip to content

Commit 67da041

Browse files
author
Yegor Bugayenko
committed
#7 fixed
1 parent 644fbaf commit 67da041

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/main/java/co/stateful/RtLock.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ public void unlock() throws IOException {
106106
public boolean lock(final String label) throws IOException {
107107
final long start = System.currentTimeMillis();
108108
final boolean locked = this.front("lock")
109-
.body().formParam("label", label).back()
109+
.body().formParam("label", label)
110+
.formParam("name", this.lck).back()
110111
.method(Request.POST)
111112
.fetch()
112113
.status() == HttpURLConnection.HTTP_SEE_OTHER;
@@ -122,7 +123,9 @@ public boolean lock(final String label) throws IOException {
122123
public boolean unlock(final String label) throws IOException {
123124
final long start = System.currentTimeMillis();
124125
final boolean unlocked = this.front("unlock")
125-
.uri().queryParam("label", label).back()
126+
.uri().queryParam("label", label)
127+
.queryParam("name", this.lck).back()
128+
.method(Request.GET)
126129
.fetch()
127130
.status() == HttpURLConnection.HTTP_SEE_OTHER;
128131
Logger.info(
@@ -144,9 +147,7 @@ private Request front(final String label) throws IOException {
144147
.as(RestResponse.class)
145148
.assertStatus(HttpURLConnection.HTTP_OK)
146149
.as(XmlResponse.class)
147-
.rel(String.format("/page/links/link[@rel='%s']/@href", label))
148-
.method(Request.GET)
149-
.uri().queryParam("name", this.lck).back();
150+
.rel(String.format("/page/links/link[@rel='%s']/@href", label));
150151
}
151152

152153
}

0 commit comments

Comments
 (0)