This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Test API "This request is only accepted using POST!" Fix

  • Loading branch information...
rico666 committed Jan 2, 2019
1 parent f9e79fe commit 0cae253fd4ca46ea8d8c86a83fd440b5e56e99ef
Showing with 5 additions and 4 deletions.
  1. +1 −1 src/brs/http/APITag.java
  2. +1 −1 src/brs/http/APITestServlet.java
  3. +1 −1 src/brs/http/GetMyPeerInfo.java
  4. +2 −1 src/brs/peer/Peers.java
@@ -5,7 +5,7 @@
ACCOUNTS("Accounts"), ALIASES("Aliases"), AE("Asset Exchange"), CREATE_TRANSACTION("Create Transaction"),
BLOCKS("Blocks"), DGS("Digital Goods Store"), FORGING("Forging"), INFO("Server Info"), MESSAGES("Messages"),
MINING("Mining"), TRANSACTIONS("Transactions"), TOKENS("Tokens"), VS("Voting System"), AT("Automated Transaction"),
FEES("Fees"), UTILS("Utils"), DEBUG("Debug");
FEES("Fees"), UTILS("Utils"), DEBUG("Debug"), PEER_INFO("Server Peer Info");

private final String displayName;

@@ -55,7 +55,7 @@
+ " }\n"
+ " $.ajax({\n"
+ " url: url,\n"
+ " type: 'GET',\n"
+ " type: 'POST',\n"
+ " })\n"
+ " .done(function(result) {\n"
+ " var resultStr = JSON.stringify(JSON.parse(result), null, 4);\n"
@@ -12,7 +12,7 @@
private final TransactionProcessor transactionProcessor;

public GetMyPeerInfo(BlockchainProcessor blockchainProcessor, TransactionProcessor transactionProcessor) {
super(new APITag[]{APITag.INFO});
super(new APITag[]{APITag.PEER_INFO});
this.blockchainProcessor = blockchainProcessor;
this.transactionProcessor = transactionProcessor;
}
@@ -834,7 +834,8 @@ private static void feedPeer(Peer peer, Function<Peer, List<Transaction>> foodDi
if(response != null && response.get("error") == null) {
doneFeedingLog.accept(peer, transactionsToSend);
} else {
logger.warn("Error feeding {} transactions: {} error: {}", peer.getPeerAddress(), transactionsToSend.stream().map(t -> t.getId()).collect(Collectors.toList()), response);
logger.warn("Error feeding {} transactions: {} error: {} - removing peer for now.", peer.getPeerAddress(), transactionsToSend.stream().map(t -> t.getId()).collect(Collectors.toList()), response);
peer.remove();
}
} else {
logger.trace("No need to feed {}", peer.getPeerAddress());

0 comments on commit 0cae253

Please sign in to comment.