Bad Request for completion
Closed this issue · 4 comments
seanfarley commented
I'm trying to debug SourceKittenDaemon but can't seem to get any debug output. Is there a flag or env variable to see what the actual error is?
My test is to create a swift project (command line) that barely has any code:
import Foundation
print("Hello, World!")
let r = GCR
I then start the server:
$ sourcekittendaemon start --project ~/Desktop/demo/demo.xcodeproj --port 8888 --verbose
And try to query:
$ curl -i -X GET "http://localhost:8888/complete?X-Offset=51Users%2Fsean%2FDesktop%2Fdemo%2Fdemo%2Fmain.swift&X-File=%2FUsers%2Fsean%2FDesktop%2Fdemo%2Fdemo%2Fmain.swift"
But only get the response:
HTTP/1.1 400 Bad Request
Content-Length: 11
Content-Type: text/plain
Bad Request
Any help would be appreciated!
nathankot commented
Hey,
Looks like you're sending the wrong value for X-Offset
:
http://localhost:8888/complete?X-Offset=51Users%2Fsean%2FDesktop%2Fdemo%2Fdemo%2Fmain.swift&X-File=%2FUsers%2Fsean%2FDesktop%2Fdemo%2Fdemo%2Fmain.swift
seanfarley commented
Sorry, bad copy/paste on my part. Even with this:
curl "http://localhost:8888/complete?X-Offset=51&X-Path=%2FUsers%2Fsean%2FDesktop%2Fdemo%2Fdemo%2Fmain.swift&X-File=%2FUsers%2Fsean%2FDesktop%2Fdemo%2Fdemo%2Fmain.swift"
it gives Bad Request
terhechte commented
X-Path and X-Offset are not query parameters, they're HTTP Headers, try:
curl "http://localhost:8888/complete" --header "X-Offset: 51" --header "X-Path: /Users/sean/file.swift"
Does that work?
seanfarley commented
Ah, yep, that was it. Thanks!