Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
Nice little macro you have here. I've had to use it for a swagger spec, and it worked pretty well. Except I needed some stuff in there as well. So I decided to add these & also fix some of the FIXME comments.
Apply whatever you want from it.
Fixes
application/json
-stringeval-when
The JSON assumption & body response mapping
Drakma has a builtin variable
*text-content-types*
which says what body content is definitely text. So since drakma automatically maps the response body to characters based on the content type header, I've added alet
-binding after the generated URL which overrides the defaultdrakma:*text-content-types*
to ensure correct behavior for json decoding which comes after. So leaving the default behavior the same, while the assumed json body is dropped. The generated function now also returns the string/byte-array when the content type header is not json as its mime subtype.base-path
toendpoint
Idk if you noticed this, but the parameters for the generated functions were applied to the
base-path
, not to theendpoint
, which seems erroneous? So I put that fix in a separate commit as well.In my case at least I got an error, because the endpoints included the path variables, not the basepath...
Additions
default-headers
keywordThe keyword allows to add in
:additional-headers
some default headers. The headers will be overwritten byheaders
when applicable. I needed to add some custom authentication headers, so I added this one.Optional
export
keywordSetting the keyword to
t
automatically adds anexport
statement for the function symbol. Defaults tonil
, so it does not mess with the existing behavior. I wanted a separate package with exported function symbols, so I added this.Thanks in advance for reviewing the PR.