Skip to content

Commit db55ba4

Browse files
committed
add application/json to Accept header to API requests
This means the API can return JSON for some requests that have no body and appropriate Content-Type.
1 parent e1e643d commit db55ba4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/MetaCPAN/Web/Model/API.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,14 @@ sub request {
117117
'Content' => encode_json($search),
118118
)
119119
: $method eq 'POST' && $params ? (
120-
'Content_Type' => 'multipart/form-data',
120+
'Content-Type' => 'multipart/form-data',
121121
'Content' => $params,
122122
)
123123
: ()
124124
),
125125
( $current_url ? ( 'Referer' => $current_url->as_string ) : () ),
126126
( $request_id ? ( 'X-MetaCPAN-Request-ID' => $request_id ) : () ),
127+
'Accept' => 'application/json, */*',
127128
);
128129

129130
my $req_p = $self->client->do_request( request => $request );

0 commit comments

Comments
 (0)