Added JsonPage and finished implementation of digest auth page
This commit is contained in:
parent
2c7a9a6eff
commit
26c09452f3
10 changed files with 244 additions and 52 deletions
34
test/zutil/net/http/page/HttpJsonPageTest.java
Executable file
34
test/zutil/net/http/page/HttpJsonPageTest.java
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
package zutil.net.http.page;
|
||||
|
||||
import org.junit.Test;
|
||||
import zutil.io.IOUtil;
|
||||
import zutil.net.http.HttpHeader;
|
||||
import zutil.net.http.HttpTestUtil;
|
||||
import zutil.parser.DataNode;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author Ziver on 2016-11-04.
|
||||
*/
|
||||
public class HttpJsonPageTest {
|
||||
|
||||
private HttpJsonPage page = new HttpJsonPage() {
|
||||
@Override
|
||||
protected DataNode jsonRespond(HttpHeader headers, Map<String, Object> session, Map<String, String> cookie, Map<String, String> request) {
|
||||
return new DataNode(DataNode.DataType.Map);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void simpleResponse() throws IOException {
|
||||
HttpHeader header = HttpTestUtil.makeRequest(page);
|
||||
assertEquals("application/json", header.getHeader("Content-Type"));
|
||||
assertEquals("{}", IOUtil.readContentAsString(header.getInputStream()));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue