FBUnknownCommands.m 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * Copyright (c) 2015-present, Facebook, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. */
  9. #import "FBUnknownCommands.h"
  10. #import "FBRouteRequest.h"
  11. @implementation FBUnknownCommands
  12. #pragma mark - <FBCommandHandler>
  13. + (BOOL)shouldRegisterAutomatically
  14. {
  15. return NO;
  16. }
  17. + (NSArray *)routes
  18. {
  19. return
  20. @[
  21. [[FBRoute GET:@"/*"].withoutSession respondWithTarget:self action:@selector(unhandledHandler:)],
  22. [[FBRoute POST:@"/*"].withoutSession respondWithTarget:self action:@selector(unhandledHandler:)],
  23. [[FBRoute PUT:@"/*"].withoutSession respondWithTarget:self action:@selector(unhandledHandler:)],
  24. [[FBRoute DELETE:@"/*"].withoutSession respondWithTarget:self action:@selector(unhandledHandler:)]
  25. ];
  26. }
  27. + (id<FBResponsePayload>)unhandledHandler:(FBRouteRequest *)request
  28. {
  29. return FBResponseWithStatus([FBCommandStatus unknownCommandErrorWithMessage:[NSString stringWithFormat:@"Unhandled endpoint: %@ with parameters %@", request.URL, request.parameters]
  30. traceback:nil]);
  31. }
  32. @end