We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 645370d commit d22a947Copy full SHA for d22a947
src/GooglePlacesTextInput.js
@@ -140,12 +140,15 @@ const GooglePlacesTextInput = forwardRef(
140
try {
141
setLoading(true);
142
const API_URL = proxyUrl ? proxyUrl : DEFAULT_GOOGLE_API_URL;
143
+ const headers = {
144
+ 'Content-Type': 'application/json',
145
+ };
146
+ if (apiKey || apiKey != '') {
147
+ headers['X-Goog-Api-Key'] = apiKey;
148
+ }
149
const response = await fetch(API_URL, {
150
method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- 'X-Goog-Api-Key': apiKey,
- },
151
+ headers,
152
body: JSON.stringify({
153
input: processedText,
154
languageCode,
0 commit comments