Skip to content

Commit

Permalink
Change method from POST to GET for DataController
Browse files Browse the repository at this point in the history
  • Loading branch information
nudemeth committed Nov 17, 2017
1 parent 56c8db7 commit 4bb1c38
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/main/frontend/js/component/view/About.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class About extends React.Component {
let url = '/data/about';
let header = new Headers({"Content-type": "application/json"});
let init = {
method: 'POST',
method: 'GET',
header: header,
cache: 'no-cache'
};
Expand Down
2 changes: 1 addition & 1 deletion src/main/frontend/js/component/view/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Home extends React.Component {
let url = '/data/home';
let header = new Headers({"Content-type": "application/json"});
let init = {
method: 'POST',
method: 'GET',
header: header,
cache: 'no-cache'
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import org.json4s.jackson.Serialization.write

class DataController extends BaseController {

post("/home") {
get("/home") {
contentType = "application/json"
write(HomeViewModel(s"This is Home page"))

}

post("/about") {
get("/about") {
contentType = "application/json"
write(AboutViewModel(s"About page"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import org.scalatra.test.scalatest.ScalatraSuite
class DataControllerTests extends ScalatraSuite with FunSuiteLike {
addServlet(classOf[DataController], "/data/*")

test("POST /data/home on DataController should return \"This is Home page\" text in body content"){
post("/data/home"){
test("GET /data/home on DataController should return \"This is Home page\" text in body content"){
get("/data/home"){
body should include ("This is Home page")
}
}

test("POST /data/about on DataController should return \"About page\" text in body content"){
post("/data/about"){
test("GET /data/about on DataController should return \"About page\" text in body content"){
get("/data/about"){
body should include ("About page")
}
}
Expand Down

0 comments on commit 4bb1c38

Please sign in to comment.