Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

receptor api returns InvalidJSON error for DesiredLRPUpdateRequest #62

Closed
shalako opened this issue Jul 17, 2015 · 4 comments
Closed

receptor api returns InvalidJSON error for DesiredLRPUpdateRequest #62

shalako opened this issue Jul 17, 2015 · 4 comments

Comments

@shalako
Copy link

shalako commented Jul 17, 2015

I'm trying to update the routes field for an LRP.

$ curl receptor.10.244.0.34.xip.io/v1/desired_lrps/scoen-1 -X PUT -d '{"routes":{"tcp-router":[{"external_port":70000,"container_port":6379}]}}'
{"name":"InvalidJSON","message":"EOF"}

I have verified that this is valid JSON.

{  
    "routes":{  
        "tcp-router":[  
            {  
                "external_port":50001,
                "container_port":6379
            }
        ]
    }
}

@amitkgupta suggested something about the payload needs to be escaped; I have not found this documented.

@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: https://www.pivotaltracker.com/story/show/99277286.

@emalm
Copy link
Member

emalm commented Jul 17, 2015

Hi, @shalako,

Can you see if your request works with a -H 'Content-Type: application/json' flag added to your curl command? It works for me with that header.

I was getting the same errors you were without it, and verbose logging on the curl command showed it was sending a 'Content-Type: application/x-www-form-urlencoded' header with the PUT request.

Thanks,
Eric

@shalako
Copy link
Author

shalako commented Jul 17, 2015

Thank you, @ematpl . Using -H 'Content-Type: application/json' resulted in a success. Two points:

  • Why is this necessary for update and not create?
  • Consider documenting this gotcha in the DesiredLRPUpdateRequest API doc?

@emalm
Copy link
Member

emalm commented Aug 24, 2015

After some inspection of the receptor codebase down to the Golang net/http standard library package, it's not clear to me why the receptor endpoints fail to process a PUT payload correctly when a Content-Type: application/x-www-form-urlencoded header is on the request. I've created a story in the Diego tracker to investigate and in the meantime added a note about this behavior to the Task and LRP API references in the receptor docs.

Thanks,
Eric

@emalm emalm closed this as completed Aug 24, 2015
jfmyers9 pushed a commit that referenced this issue Mar 2, 2016
Submodule src/github.com/pkg/sftp cbc2879..e84cc8c:
  > Merge pull request #85 from pkg/rootdir
  > Merge pull request #81 from pkg/server-option
  > Merge pull request #80 from pkg/functional-options
  > Merge pull request #78 from pkg/server-readonly
  > Merge pull request #79 from pkg/readme-badges
  > Merge pull request #77 from pkg/namedreturns
  > Merge pull request #75 from pkg/golint
  > Merge pull request #73 from mdlayher/golint
  > Merge pull request #74 from LiterallyElvis/master
  > Merge pull request #72 from mdlayher/master
  > Merge pull request #70 from pkg/fixedbugs/69
  > Merge pull request #67 from mdlayher/master
  > Merge pull request #64 from pkg/fixedbugs/28
  > Merge pull request #63 from pkg/fixedbugs/5
  > Merge pull request #61 from pkg/add-travis
  > Merge pull request #62 from xiu/bugfix/35-cant-remove-directories-on-servu
  > Merge pull request #58 from sykesm/client-realpath
  > Merge pull request #60 from pkg/fixedbugs/57
  > updated contribution guidelines

Signed-off-by: James Myers <jmyers@pivotal.io>
mariash added a commit that referenced this issue Aug 30, 2022
Submodule src/code.cloudfoundry.org/cacheddownloader 42ae8cc91..d36aabd1d:
  > Test that io.Copy is canceled (#15)
Submodule src/code.cloudfoundry.org/executor e5bac5f28..f1159c8bc:
  > Cancel download of dependencies on failure (#62)
mariash added a commit that referenced this issue Sep 1, 2022
Submodule src/code.cloudfoundry.org/cacheddownloader 42ae8cc91..d36aabd1d:
  > Test that io.Copy is canceled (#15)
Submodule src/code.cloudfoundry.org/executor e5bac5f28..f1159c8bc:
  > Cancel download of dependencies on failure (#62)
tas-runtime-bot added a commit that referenced this issue Jun 14, 2023
…credhub-cli diego-ssh dockerapplifecycle ecrhelper executor fileserver healthcheck inigo localdriver locket operationq rep route-emitter routing-api routing-info systemcerts vizzini volman workpool garden grootfs guardian idmapper

Submodule src/code.cloudfoundry.org/auction 46a89db7a..4c03ffcd7:
  > Add CODEOWNERS file in preparation for branch protection rules (#16)
Submodule src/code.cloudfoundry.org/auctioneer be803dc1e..ec7efd6f7:
  > Add CODEOWNERS file in preparation for branch protection rules (#14)
Submodule src/code.cloudfoundry.org/buildpackapplifecycle 717bad3b1..cb243e1d2:
  > Merge pull request #48 from Infra-Red/staging-error
  > Merge pull request #62 from geofffranks/main
Submodule src/code.cloudfoundry.org/cacheddownloader a005bb235..2caa6ca34:
  > Add CODEOWNERS file in preparation for branch protection rules (#25)
Submodule src/code.cloudfoundry.org/cfdot ef69fb66b..4d194a115:
  > Add CODEOWNERS file in preparation for branch protection rules (#8)
Submodule src/code.cloudfoundry.org/credhub-cli a97b4319d..aa8fc4e79:
  > Bump go modules
Submodule src/code.cloudfoundry.org/diego-ssh 1bdd96ca0..7461829a9:
  > Add CODEOWNERS file in preparation for branch protection rules (#49)
Submodule src/code.cloudfoundry.org/dockerapplifecycle 0e49eedc7..93dcb397b:
  > Add CODEOWNERS file in preparation for branch protection rules (#12)
Submodule src/code.cloudfoundry.org/ecrhelper 3949c0207..56a9cdc53:
  > Add CODEOWNERS file in preparation for branch protection rules (#3)
Submodule src/code.cloudfoundry.org/executor d6dd1132b..2c29c7e2f:
  > Add CODEOWNERS file in preparation for branch protection rules (#81)
Submodule src/code.cloudfoundry.org/fileserver f3dfda90a..ddeb9bd6d:
  > Add CODEOWNERS file in preparation for branch protection rules (#8)
Submodule src/code.cloudfoundry.org/healthcheck ba40fd720..6587beaf1:
  > Add CODEOWNERS file in preparation for branch protection rules (#10)
Submodule src/code.cloudfoundry.org/inigo 8e5bf0cc7..b300679e6:
  > Add CODEOWNERS file in preparation for branch protection rules (#27)
Submodule src/code.cloudfoundry.org/localdriver bfbf40217..6d5a2bf56:
  > Add CODEOWNERS file in preparation for branch protection rules (#3)
Submodule src/code.cloudfoundry.org/locket 6cd541649..08e003863:
  > Add CODEOWNERS file in preparation for branch protection rules (#15)
Submodule src/code.cloudfoundry.org/operationq 4522d0860..b625ea3c1:
  > Add CODEOWNERS file in preparation for branch protection rules (#3)
Submodule src/code.cloudfoundry.org/rep 8550a6340..192ca3a5a:
  > Add CODEOWNERS file in preparation for branch protection rules (#43)
Submodule src/code.cloudfoundry.org/route-emitter b5abb628c..a17e814f0:
  > Add CODEOWNERS file in preparation for branch protection rules (#25)
Submodule src/code.cloudfoundry.org/routing-api 9592985dc..b9e9e0b90:
  > Add CODEOWNERS file in preparation for branch protection rules
Submodule src/code.cloudfoundry.org/routing-info c6998d604..079a27345:
  > Add CODEOWNERS file in preparation for branch protection rules
Submodule src/code.cloudfoundry.org/systemcerts 221d6f2ae..10f68b45f:
  > Add CODEOWNERS file in preparation for branch protection rules (#2)
Submodule src/code.cloudfoundry.org/vizzini 906e23011..5a2ef7822:
  > Add CODEOWNERS file in preparation for branch protection rules (#6)
Submodule src/code.cloudfoundry.org/volman 76091d503..b60663cd4:
  > Add CODEOWNERS file in preparation for branch protection rules (#6)
Submodule src/code.cloudfoundry.org/workpool 2e26d5d93..b93da105e:
  > Add CODEOWNERS file in preparation for branch protection rules (#3)
Submodule src/garden ac53c57dc..2d96d2498:
  > Bump lager to v3.0.2
  > Update go.mod dependencies
Submodule src/grootfs 9ea0d4bb9..f8dceb408:
  > Bump lager to v3.0.2
  > Update go.mod dependencies
  > Merge pull request #217 from geofffranks/main
Submodule src/guardian fac28108a..809884ce5:
  > Bump lager to v3.0.2
  > Update go.mod dependencies
  > Merge pull request #402 from geofffranks/main
Submodule src/idmapper a41052025..39b35b84a:
  > Merge pull request #71 from geofffranks/main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants